Page 1 of 1

convert -crop ... fails on png files

Posted: 2008-03-31T00:48:47-07:00
by janilrau
I'm experiencing serious trouble when cropping PNG images...

Here my example. The size of the image is 26,8 MB (3988 x 4288 pixel) and it is located here:
http://www.posterjack.com/kj_tmp/200803 ... 4_leri.png

and then try this (the error I got during crop operation of PNG files):
# flip image (works!)
convert 20080331091752540734_leri.png +flip 20080331091752540734_mx.png

# now crop a region
# Convert issues a warning and generates the 1 px transparent file named 20080331091752540734_bo.png, but it should crop the indicated region

convert 20080331091752540734_mx.png -crop 3988x572+0+0 20080331091752540734_bo.png



Afterwards try this (works fine, only difference: now processing JPG files):
# flip image (works!)
convert 20080331091752540734_leri.png +flip 20080331091752540734_mx.jpg

# now crop a region
# Convert cropes the region correctly

convert 20080331091752540734_mx.jpg -crop 3988x572+0+0 20080331091752540734_bo.jpg

I would prefer to process PNG due to the lossless compression/decompression. Is there a workaround for this bug?

Thanks karsten
karsten dot jursch at fleiheit dot com

Re: convert -crop ... fails on png files

Posted: 2008-03-31T06:34:04-07:00
by magick
To fix the problem you reported, use this command to reset the virtual canvas of your image:
  • convert 20080331091752540734_mx.png +repage -crop 3988x572+0+0 20080331091752540734_bo.png

Re: convert -crop ... fails on png files

Posted: 2008-04-01T18:13:00-07:00
by janilrau
ok, thanks a lot I'll try this, but I don't understand the difference in positioning the image on a virtula canvas between PNG and JPG.

Does it mean, that my JPG code (that works fine) is wrong?

Re: convert -crop ... fails on png files

Posted: 2008-04-01T18:36:40-07:00
by magick