Title | Malformed TIFF images solution |
Detailed description | A Python2 script takes files and directories as command line arguments. It attempts to open images using PIL (Python Imaging Library) and collects statistics on the images which can indicate how much black there is in the images. For an unmodified scan or photo, there shouldn't be any pure black. The output from the script can be opened in a spreadsheet application. Examining the TIFF files using hexdump, the black areas are caused by black pixels (0s), rather than un-terminated tags. In the sample, most TIFFs did not have black areas. Quite a few did, and a small number of TIFFs were nothing but 0s. |
Solution Champion | ![]() |
Corresponding Issue(s) | |
Tool/code link | https://github.com/downloads/openplanets/SPRUCE/tiff_black_pixel_reporter.py![]() also checked in as SPRUCE/tree/master/black_pixels ![]() |
Tool Registry Link![]() |
|
Notes | The script is run as so: It will process any images below directory1, the files somefile.tif, another.tiff and any images below directory2. The output is in CSV: The first line shows an image which has no black pixels, so no percentage of black pixels. The second line shows an image which has a large number of black pixels, covering 95% of the image. The third line shows an image which is full of zeros. It couldn't be opened by PIL as an image, so the width and height couldn't be established. |
Evaluation |
|