[Lazarus] How to save screenshot to jpg and png format files
pch at ap-i.net
Thu Apr 29 18:49:06 CEST 2021
This work because Bgrabitmap set automatically the image writer based on the extension.
29 avril 2021 17:49 "Bo Berglund via lazarus" <lazarus at lists.lazarus-ide.org> a écrit:
> I have an application which can capture a regon of the desktop into an image.
> It uses TBgraBitmap since it has a method for grabbing data from the screen.
> So I can assign this to the clipboard and also save to a file:
> MyCapture : TBgraBitmap;
> Clip: TRect;
> Clip := Bounds(Self.Left, Self.Top, Self.Width, Self.Height);
> MyCapture := TBgraBitmap.Create();
> MyCapture.Bitmap.SaveToFile(ChangeFileExt(ParamStr(0), '.jpg'));
> But the SaveToFile results in a file that is NOT a jpeg file at all...
> How could I save it to a specific (known) format, like jpg or png?
> Bo Berglund
> Developer in Sweden
> lazarus mailing list
> lazarus at lists.lazarus-ide.org
More information about the lazarus