Title: Converting a Bitmap to JPEG
Question: When you have a database with bitmaps (BMP) and you want make an export your data to HTML pages, you have to convert the Bitmaps to JPEG-files
Answer:
here is some sample code to convert and save your bitmaps as jpg-files:
var
aJPEGImage : TJPEGImage;
aPicture : TPicture;
aPicture := TPicture.Create;
aJPEGImage := TJPEGImage.Create;
try
aPicture.Bitmap.Assign(Query.FieldByName(Fieldname));
aJPEGImage.Assign(aPicture.Graphic);
aJPEGImage.SaveToFile('filename.jpg');
finally
aPicture.Free;
aJPEGImage.Free;
end
ps. Don't forget to include the 'jpeg' unit in your uses clause