Function graphictobmp (p: tpicture; qualy: integer = 80): Tbitmap;
VAR
JPG: TJPEGIMAGE;
Begin
Result: = Tbitmap.create;
WITH RESULT DO
Begin
Width: = p.width;
Height: = p.height;
Canvas.DRAW (0, 0, p.graphic);
END;
IF assigned (result) THEN
Begin
JPG: = tjpegimage.create;
Jpg.Assign (Result);
Jpg.compressionquality: = QUALITY
Jpg.jpegneed;
Jpg.com;
IF assigned (jpg) THEN
Begin
Jpg.dibneed;
Result.Assign (JPG);
END;
END;
END;