DecodeModernImageToPNG
Image handling
Description
Decodes a modern image stream to a PNG image stream
A registered backend callback runs first; without one the native codec library renders the image, applies EXIF orientation when requested and preserves the embedded ICC profile
Syntax
Delphi
Function DecodeModernImageToPNG(InStream, OutPNG: TStream;
ImageFormat: TPDFlibModernImageFormat;
ApplyOrientation: Boolean= True): Boolean;Parameters
| InStream | Stream holding the complete modern image; the position is saved and restored |
|---|---|
| OutPNG | Stream receiving the PNG bytes; with a backend callback it is reset to position 0 and sized to the output on success |
| ImageFormat | Format to decode, from DetermineModernImageFormat; mifUnknown fails immediately |
| ApplyOrientation | Applies the stored orientation so the PNG is upright, on by default |
Return values
| False | No backend is registered and the codec module is missing or lacks the coder, the format is unknown, or the decode failed |
|---|---|
| True | OutPNG holds a complete PNG image |
Remarks
The AddModernImageFromStream family wraps this helper and embeds the PNG into the page; calling it directly is the way to pre-convert or inspect images without a TPDFlib instance
See also
DetermineModernImageFormat, RegisterModernImageDecoderBackend, AddModernImageFromStream, ModernImageCodecAvailable