Operations > OP_PNGTRANSCODE |
OP_PNGTRANSCODE: Transcode PNG to optimized PNG
See the PNGT_UNION:OP_PNGTRANSCODE section for additional information.
OP_PNGTRANSCODE is used for optimizing standard .PNG images for minimal size while maintaining lossless fidelity to the input image.
Input PNG files are optimized by recompressing the input image using an optimal pre-compression filter that is chosen based on the image characteristics. Pre-tuned parameters for the zlib compressor are utilized to maximize compression and reduce IDAT overhead. Additional size minimization is achieved by discarding certain ancillary chunks, by optimizing the propagation of transparency information to the output image, and by eliminating interlacing.
Ancillary chunks are processed as follows:
Alpha-Channel transparency information is processed as follows:
In the current version of the opcode, the following descriptions only apply to 8-bit Gray with alpha (Color-Type 4) images. |
Input images that are interlaced will always be transcoded to non-interlaced output images.
u.PNGT.Region is set by OP_PNGTRANSCODE during REQ_INIT. The region values reflect the values in the IHDR chunk and any PLTE (palette) chunk of the PNG file. In order to support larger images, this opcode exclusively supports the use of REGION2. See the REGION2 section for more information.
PF_IsColorMapped will be set for PNG images that are color-mapped. PF_IsGray will be set for PNG images that are represented within the file as gray or for color-mapped images whose palette contains only shades of gray. PF2_HaveAlpha will be set for PNG images that have an alpha channel or transparency information (tRNS chunk).
Certain other u.PNG fields may be useful to an application. They may be ignored by the user. The values are retrieved from the image and returned to the application by OP_PNGTRANSCODE. For more information about these fields, see the PNGT_UNION:OP_PNGTRANSCODE section. These fields are: u.PNGT.Interlace, ResolutionUnit, XResolution, YResolution, AlphaBpp, and BitDepth.
PF_IsGray and PF_IsColorMapped can be examined to determine the original form of a converted image.