Board index » delphi » Canvas for JPEGs?

Canvas for JPEGs?

Anyone know if you can write TRectangles to the canvas property of JPEG/GIF
files? I can do it with BMPs using canvas property, but this call not
supported for JPEGs. Anyone have some cool tricks?

Mike

 

Re:Canvas for JPEGs?


  I believe what most people do is to copy the JPEG to a bitmap, do the drawing
on the bitmap canvas, then copy that back  to the JPEG:

TempBMP := TBitmap.Create;
TempBitmap.Width := JPEG.Width;
TempBitmap.Height := JPEG.Height;
{for d3 or d4}
TempBitmap.PixelFormat := pf24bit;
TempBitmap.Canvas.Draw(0,0,JPEG);
TempBitmap.Canvas.Rectangle(10,10,20,20);
JPEG.Assign(TempBitmap);
TempBitmap.Free;

Or something along those lines...  I have not tested the above code, so
consider it pseudo code.  HTH :)

Quote
MKaufman wrote:
> Anyone know if you can write TRectangles to the canvas property of JPEG/GIF
> files? I can do it with BMPs using canvas property, but this call not
> supported for JPEGs. Anyone have some cool tricks?

> Mike

--
Harm  (remove thebaragain for email)

"Two major products came out of Berkely in the 70's;
Unix and LSD.  It's not a coincidence."

Other Threads