PNG expected N bytes; found N bytes.
Posted: 2017-03-28T08:34:19-07:00
I've got an image, that seems to be corrupted but only to certain extend. Viewers actually are able to preview it (browser, and ubuntu image viewers).
So this works:
Outputs:
But this command:
Or:
Fails with error:
And URL to image: https://s3-eu-west-1.amazonaws.com/stat ... /image.png
So behaviour here is a bit inconsistent, and many other vendors choose to "deal" with such files by partially rendering it.
To help developers to use tool, it would be good to be able to identify corruption of file in all cases and print consistent info that file is corrupted so developers can make their app logic to react accordingly.
So this works:
Code: Select all
identify image.png
Code: Select all
image.png PNG 1024x1024 1024x1024+0+0 8-bit sRGB 492KB 0.000u 0:00.000
Code: Select all
identify -verbose image.png
Code: Select all
identify -format "%A" image.png
Code: Select all
identify: Expected 8192 bytes; found 8067 bytes `image.png' @ warning/png.c/MagickPNGWarningHandler/1683.
identify: Read Exception `image.png' @ error/png.c/MagickPNGErrorHandler/1650.
identify: corrupt image `image.png' @ error/png.c/ReadPNGImage/4029.
So behaviour here is a bit inconsistent, and many other vendors choose to "deal" with such files by partially rendering it.
To help developers to use tool, it would be good to be able to identify corruption of file in all cases and print consistent info that file is corrupted so developers can make their app logic to react accordingly.