[fpc-devel] Saving TImage Bitmap as shown

Nathan Wild nathan.wild at gmail.com
Sat Mar 15 19:13:33 CET 2014


Is there any way to tell a TImage to save it's Bitmap as-shown?  I need to
do some relatively simple image resizing in order to ensure images display
properly in another application.  To do this they need to be a fixed size
(512x768), but I need to preserve their aspect ratio by adding padding to
the top, bottom and sides, as required.

For example, if my source image is 100x100, I can scale it up to 512x512
easily enough, but I need have the end result image be 512x768 with padding
(solid colour, etc.) at the top and bottom to ensure it is centred.

If you take a TImage control, load the 100x100 example image, set:
Width := 512;
Height := 768;
Centered := TRUE;
Proportional := TRUE;
Stretch := TRUE;

The image it contains will display in exactly the way I am after.  I am
just not sure how to tell the TImage to save THAT image.

Thanks for any help...

-- 
*Nathan T. Wild*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-devel/attachments/20140315/8a1977ee/attachment.html>


More information about the fpc-devel mailing list