TPNGImage help

PNG Delphi

Errors handling


The new PNG Delphi introduces a few new classes to handle different errors. All this classes are descendent from Exception meaning that the error might be handled using the try operator from delphi. It's recommended to handle errors when using the methods LoadFromFile, SaveToFile, LoadFromStream and SaveToStream from TPNGObject.

The new classes introduced are:

Error class

Description

EPngError Can be several errors, but it's never called when the image is being loaded or saved.
EPngUnexpectedEnd The decoder found an invalid end of the file.
EPngInvalidCRC One or more chunks contain an invalid crc identifier which is provided within each chunk
EPngInvalidIHDR The size from the IHDR chunk is invalid
EPNGMissingMultipleIDAT The IDAT chunk data has ended and it still misses image parts
EPNGZLIBError ZLIB returns an error, common causes are low memory or invalid compressed data
EPNGInvalidPalette The PLTE chunks contains an invalid number of entries
EPNGInvalidFileHeader The Portable Network Graphics image contains an invalid file header.
EPNGIHDRNotFirst The IHDR chunk is not the first chunk on the image but it must
EPNGNotExists The file does not exists.
EPNGSizeExceeds Either width or height is more than 65535 pixels.
EPNGMissingPalette The image uses a color table but PLTE chunk was not found
EPNGUnknownCriticalChunk The image contains an unknown critical chunk
EPNGUnknownCompression The image uses an unknown compression method found on the IHDR chunk
EPNGUnknownInterlace The image uses an unknown interlacing method found on the IHDR chunk
EPNGNoImageData There is no IDAT chunk.