BOOL32 __stdcall pdfReadImageFormatA(PPDF IPDF, const char* FileName, uint32_t* Width, uint32_t* Height, int32_t* BitsPerPixel, int32_t* UseZip);
BOOL32 __stdcall pdfReadImageFormatW(PPDF IPDF, const wchar_t* FileName, uint32_t* Width, uint32_t* Height, int32_t* BitsPerPixel, int32_t* UseZip);
function pdfReadImageFormatA(const IPDF: PPDF; const FileName: PAnsiChar; var Width, Height: Cardinal; var BitsPerPixel, UseZip: Integer): LongBool; stdcall;
function pdfReadImageFormatW(const IPDF: PPDF; const FileName: PWideChar; var Width, Height: Cardinal; var BitsPerPixel, UseZip: Integer): LongBool; stdcall;
Purpose. Read an image file's geometry (dimensions, effective bits-per-pixel, and whether it will be Flate- vs. DCT-compressed if embedded) without loading it into the document — a pure inspection call using the SDK's own general-purpose image loader.
Description. Delegates to the same LoadImageFile used by the real image-embedding path (V07), decodes the file fully into a transient TLumasLoadedImage, reports Width/Height and BitsPerPixel = Img.BPC * Img.NumComps (bit depth × component count — e.g. 8-bit RGB = 24, not the file's own nominal bit depth if that differs), frees the loaded image, and returns. UseZip is derived, not read from the file: 1 unless the image is a JPEG (Ord(Img.Kind <> ikJpeg)) — i.e. it reports "would this be Flate/Zip-compressed if embedded via this SDK's default policy" rather than any property of the file itself. Any format LoadImageFile supports (JPEG/PNG/BMP/GIF/TIFF/JP2, per V07) works here.
Parameters.
| Parameter | Description |
|---|---|
IPDF | Document handle (used only to resolve the doc context; the file itself is read independently of document state). |
FileName | Path to the image file. |
Width, Height | Output: pixel dimensions. |
BitsPerPixel | Output: BPC * NumComps, not necessarily the file's own reported bit depth. |
UseZip | Output: 1 unless the image is JPEG — reflects this SDK's embedding compression policy, not a file property. |
Return value. True if the file loaded and decoded successfully; False otherwise (file missing, unsupported/corrupt format).
C# (P/Invoke)
[return: MarshalAs(UnmanagedType.Bool)]
Core
pdfReadImageFormat
pdfReadImageFormatA
pdfReadImageFormatW
The …A form takes UTF-8, …W
takes UTF-16; a bare name aliases the ANSI form.
Worked examples — complete programs in ten languages.