BGRAImageManipulation inside bgracontrols-1.4.0.1 saturation problem ? lazarus / 31-LCL ---------------------------------------------------------------------- seba22 · 2013-01-03 10:33 Hello, I'm working in Ubuntu 11.10 x86 using Lazarus 1.0.4 I have installed this widgets -> bgracontrols-1.4.0.1 I'm looking for way to allow user "crop" section of image. I wrote simple application, using demo. Code: [Select]unit Unit1; {$mode objfpc}{$H+} interface uses   Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,   BGRAImageManipulation,BGRABitmap,   BGRABitmapTypes,BGRAPanel; type   { TForm1 }   TForm1 = class(TForm)     BGRAImageManipulation1: TBGRAImageManipulation;     Button1: TButton;     Button2: TButton;     procedure Button1Click(Sender: TObject);     procedure Button2Click(Sender: TObject);   private     { private declarations }   public     { public declarations }   end; var   Form1: TForm1; implementation {$R *.lfm} { TForm1 } procedure TForm1.Button1Click(Sender: TObject);  var   Bitmap: TBGRABitmap; begin     Bitmap := TBGRABitmap.Create;     Bitmap.LoadFromFile('/home/alan/Pictures/Screenshot from 2013-01-03 11:24:09.png');     BGRAImageManipulation1.Bitmap := Bitmap;     Bitmap.Free; end; procedure TForm1.Button2Click(Sender: TObject);   var   JpegImage: TJpegImage; begin   // This example save image compress in JPEG format       // Compress       JpegImage := TJpegImage.Create;       JpegImage.Assign(BGRAImageManipulation1.getBitmap);       JpegImage.CompressionQuality := 100;       // And save to file       JpegImage.SaveToFile('/home/alan/Pictures/output.jpg');       JpegImage.Free; end; end. Problem is in colours of saved image: I attach  input file and output file. It's ugly Yellow No errors, no notifications... just yellow... saturated colors... Do You have any idea what's going on? ---------------------------------------------------------------------- User137 · 2013-01-03 10:56 Other than million years old Lazarus, it seems color channels are getting messed up, or something else. (Reminds me of, why someone named it BGRA    Normal color channels are written in order RGBA.) Code: [Select]BGRAImageManipulation1.Bitmap := Bitmap; Bitmap.Free;I would also be careful with code like that. You give address of Bitmap object to manipulator, and then you free it. Hopefully it's a property that copies the data from your bitmap. If it wasn't, i guess you wouldn't even see that yellow image. Can you do this, or is Bitmap originally nil (in which case this crash)? Code: [Select]procedure TForm1.Button1Click(Sender: TObject); begin     BGRAImageManipulation1.Bitmap.LoadFromFile('/home/alan/Pictures/Sc reenshot from 2013-01-03 11:24:09.png'); end; ---------------------------------------------------------------------- seba22 · 2013-01-03 11:06 Quote from: User137 on January 03, 2013, 11:56:19 amOther than million years old Lazarus, it seems color channels are getting messed up, or something else. (Reminds me of, why someone named it BGRA    Normal color channels are written in order RGBA.) Code: [Select]BGRAImageManipulation1.Bitmap := Bitmap; Bitmap.Free;I would also be careful with code like that. You give address of Bitmap object to manipulator, and then you free it. Hopefully it's a property that copies the data from your bitmap. If it wasn't, i guess you wouldn't even see that yellow image. Can you do this, or is Bitmap originally nil (in which case this crash)? Code: [Select]procedure TForm1.Button1Click(Sender: TObject); begin     BGRAImageManipulation1.Bitmap.LoadFromFile('/home/alan/Pictures/Sc reenshot from 2013-01-03 11:24:09.png'); end; Uhm ^^ Your code crash  with "Invalid floating point operation.". Previous code, work itself  and load into form image with good collors, look at screenshot. Any other idea?