How to save a picture to file

The PDF Creator enables you to create secure PDF documents and to view, print and process existing PDF documents.
If you have any questions about the installation and usage of the PDF Creator please post them here.
Post Reply
Posts: 6
Joined: Tue Nov 04 2008

How to save a picture to file

Post by calle »


How should I save a picture (object) to a file?

I have the following kind of code now but the saved picture mostly contains question marks:

width,height,bitsperpixel : integer;
ByteCount : integer;
pixels : string;

ByteCount:=(bitsperpixel * width * height) div 8; // Calculate size (in bytes) of image data
if (bitsperpixel * width * height) mod 8 > 0 then inc(ByteCount);
if bitsperpixel=1 then ByteCount:=ByteCount*2;
SetLength(Pixels, ByteCount);

SetLength(Pixels, 0);
Posts: 119
Joined: Fri Oct 14 2005
Location: Montreal

Re: How to save a picture to file

Post by Devteam »

The data that you obtain using the method below are only the scanlines as an uncompressed BMP. You are saving it as a TIF file which is not right. You need to write the BMP header to the file followed by the bitmap data and save the file as .BMP file. We are looking at adding a method to the picture object that would simply save the whole image to a file or a memory stream.
Amyuni Development Team

Efficient and accurate conversion to PDF, XPS, PDF/A and more. Free trials at -
Post Reply