zenodo / zenodo-rdm

Zenodo, powered by InvenioRDM
https://zenodo.org
GNU General Public License v2.0
41 stars 25 forks source link

Error handling in case of corrupt images #822

Open 0einstein0 opened 4 months ago

ptamarit commented 4 months ago

Testing of corrupted images

Creation of the corrupted image files

Execution of the processing of the corrupted files

for filename in vips*.*; do
    echo "-------------------------------"
    echo "$filename"
    vips tiffsave "$filename" "output-$filename.tif" --tile --pyramid --tile-width 256 --tile-height 256 --compression "jpeg"
    echo "Exit code: $?"
done

Output:

-------------------------------
vips-padded.png

(vips:97162): VIPS-WARNING **: 16:21:31.715: pngload: end of stream
...
(vips:97162): VIPS-WARNING **: 16:21:31.720: pngload: end of stream
Exit code: 0
-------------------------------
vips-truncated.png

(vips:97177): VIPS-WARNING **: 16:21:31.768: pngload: end of stream
...
(vips:97177): VIPS-WARNING **: 16:21:31.773: pngload: end of stream
Exit code: 0
-------------------------------
vips.txt
VipsForeignLoad: "vips.txt" is not a known file format
Exit code: 1
-------------------------------
vips.xml
magickload: Magick: unable to read image data `vips.xml' @ error/svg.c/RenderRSVGImage/457 (null)
Exit code: 1

Conclusion

Adapting the usage of pyvips to properly handle corrupted images