1
Use this function to generate images in the system:
procedure converte_jpg(Bitmap: TBitmap; Stream: TMemoryStream);
var
surf: TBitmapSurface;
saveParams : TBitmapCodecSaveParams;
begin
surf := TBitmapSurface.Create;
try
surf.Assign(Bitmap);
saveParams.Quality:= 20;
if not TBitmapCodecManager.SaveToStream(Stream, surf, '.jpg',@saveParams)
then
raise EBitmapSavingFailed.Create(SBitmapSavingFailed);
finally
Surf.Free;
end;
end;
I call her that
img.Bitmap.LoadFromStream(imagem);
converte_jpg(img.Bitmap,thumb_img);
the result of the function is a Tmemorystream that I saved in the database, the function works normally in the main thread, but when I put it inside an anonymous thread, the following error
Bitmap size Too big.