PNG geometry and the *original* image canvas
Posted: 2015-02-04T17:48:31-07:00
Used the following to crop a directory full of PNG images:
Expected resulting images to be 1080x300 however I did not realize that the PNG preserves geometry reference of the *original* image, and the source images to the above command were the output of a previous been crop, as follows:
The end result of the 1080x300+0+0 crop have dimensions of only 1080x119 and ruined all the images. So glad I have a backup of the source images somewhere!
I think this default behavior is counter-intuitive, and should be either changed or at least better documented. The initial crop and subsequent operations could have been performed by different users or processes and so geometry should by default be relative the the input image, not to some ancient "original" version.
Code: Select all
mogrify -crop 1080x300+0+0 *.png
Code: Select all
mogrify -crop 1080x1920+0+181 *.png
I think this default behavior is counter-intuitive, and should be either changed or at least better documented. The initial crop and subsequent operations could have been performed by different users or processes and so geometry should by default be relative the the input image, not to some ancient "original" version.