pdfGetImageBitmap
idx
th image on the page specified in the
last call to pdfGetImages
.
In the Windows version of XpdfImageExtract, this function fills in
a BITMAPINFOHEADER
structure. In the Linux and Mac
versions, it fills in a PDFImageHeader
structure defined
in XpdfImageExtract.h
. In either case, the second
argument is the image index (same as for pdfGetImageInfo
), the
third argument is a pointer to the image header structure
(BITMAPINFOHEADER
or PDFImageHeader
, and the
fourth argument is a pointer to the image bitmap data.
For image masks and monochrome images, this function creates a one-bit-deep bitmap. For grayscale images, it creates an 8-bit grayscale bitmap. All color images are converted to 24-bit RGB.
On Windows: The data returned in bits
is stored in
bottom-up (upside-down) format, with each line padded to a multiple of
32 bits (standard Windows bitmap format).
On Linux and Mac: For image masks and monochrome images,
the hdr.color
flag is set
to pdfImageExtractMono
, and the data returned
in bits
is one bit per pixel. For grayscale images,
the hdr.color
flag is set
to pdfImageExtractGray
, and the bits
data is
8 bits per pixel. For color images, hdr.color
is set
to pdfImageExtractRGB
, and the bits
data is
24 bits per pixel (R, G, B order). The lines are stored in top-down
format, and for monochrome images each line starts at a byte boundary.
The caller is responsible for calling pdfFreeMemory
to free
the bits
pointer after using it.