pngcheck
Verify PNG image file integrity
TLDR
Verify the integrity of an image file (width, height, and color depth)
Print information for an image with [c]olorized output
Print [v]erbose information for an image
Receive an image from stdin and display detailed information
[s]earch for PNGs within a specific file and display information about them
Search for PNGs within another file and e[x]tract them
SYNOPSIS
pngcheck [options] file [file...]
pngcheck -l
PARAMETERS
file
The path to one or more PNG files to be checked.
-v
Enable verbose output, showing more details about chunks and data.
-p
Print all chunk names found in the file.
-c
Print names of critical chunks (IHDR, PLTE, IDAT, IEND) only.
-t
Print contents of text chunks (tEXt, zTXt, iTXt).
-f
Report only the first error encountered and then exit.
-e
Print extended information, such as chunk length and CRC values.
-o offset
Start checking the file from the specified byte offset. Useful for embedded PNGs.
-l
List all known PNG chunk types supported by pngcheck and exit. This option does not take file arguments.
-q
Enable quiet mode; suppress all output except for error messages or exit status.
-s
Print statistics about the PNG file, including dimensions, color depth, interlace type, etc.
-S
Print short statistics (a subset of -s information).
-T
Do not check CRCs for IDAT (image data) chunks. This can speed up checks but is less thorough.
-C
Check all CRCs, including for non-critical chunks and IDAT chunks (default behavior unless -T is used).
-V
Print the version information of pngcheck and exit.
DESCRIPTION
pngcheck is a command-line utility designed to check the integrity and validity of Portable Network Graphics (PNG) files. It thoroughly examines the internal structure of PNG images, verifying chunk integrity, CRC (Cyclic Redundancy Check) values, and adherence to the PNG specification. This tool is invaluable for detecting corrupted or malformed PNG files, identifying files that do not conform to the standard, or debugging issues related to PNG image processing.
Beyond simple error detection, pngcheck can also print detailed information about the PNG file's chunks, dimensions, color depth, and other attributes. It's widely used by developers, system administrators, and anyone who needs to ensure the reliability and interoperability of PNG images in their workflows.
CAVEATS
While pngcheck excels at validating the structural integrity and specification compliance of PNG files, it does not perform visual rendering tests. Therefore, a file deemed 'valid' by pngcheck might still display incorrectly in certain applications if it contains valid but visually problematic data (e.g., incorrect color profiles not violating PNG spec but causing display issues). Its primary focus is on byte-level adherence to the PNG standard.
EXIT STATUS
pngcheck returns an exit status of 0 if all specified PNG files are valid and no errors are found. A non-zero exit status indicates that one or more files are invalid or that an internal error occurred, making it suitable for use in shell scripts and automated validation workflows.
PNG CHUNKS
PNG files are composed of a series of chunks, each containing specific data (e.g., image header, palette, image data, text information). pngcheck meticulously examines these chunks, verifying their length, type, CRC, and order, ensuring the file's adherence to the PNG specification.
HISTORY
pngcheck was developed by Glenn Randers-Pehrson, a significant contributor to the PNG (Portable Network Graphics) specification. It emerged as a vital tool within the libpng ecosystem, designed to help ensure the robustness and interoperability of PNG images across various platforms and applications. Its development was driven by the need for a reliable command-line utility to validate PNG files against the official standard, aiding developers in identifying and rectifying issues that could lead to malformed or non-compliant image files.