crop and extact to png

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
imaggie
Posts: 88
Joined: 2011-12-19T04:15:36-07:00
Authentication code: 8675308

crop and extact to png

Post by imaggie »

Image

The above was created by the following command:

Code: Select all

convert -gravity NorthEast -crop "600x600+0+0" biche.jpg biche.png
It seems IM is producing something that has a different meaning to GIMP.

IM bug, GIMP bug or png spec abiguity?

thx
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: crop and extact to png

Post by glennrp »

Use the +repage option to get rid of the offset information left over from the cropping operation. Also it's best to put the processing options after reading the input image:

Code: Select all

convert biche.jpg -gravity NorthEast -crop "600x600+0+0" +repage biche.png
imaggie
Posts: 88
Joined: 2011-12-19T04:15:36-07:00
Authentication code: 8675308

Re: crop and extact to png

Post by imaggie »

many thanks for clearing that up.

How should I have know to do this? I have gone over the doc for -extract and crop many times now and see no indication that there is some residual information nor of the need to "repage".
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: crop and extact to png

Post by glennrp »

imaggie wrote:many thanks for clearing that up.

How should I have know to do this? I have gone over the doc for -extract and crop many times now and see no indication that there is some residual information nor of the need to "repage".
I suppose it's easy to miss, but the last paragraph under the -crop section of the command-line options says
  • It might be necessary to +repage the image prior to cropping the image to ensure
    the crop coordinate frame is relocated to the upper-left corner of the visible image.
I don't know if it will help much, but I'm adding
  • This is especially true when you are going to write to an image format such
    as PNG that supports an image offset.
to that paragraph.
imaggie
Posts: 88
Joined: 2011-12-19T04:15:36-07:00
Authentication code: 8675308

Re: crop and extact to png

Post by imaggie »

It does indeed. :oops:

IM has a learning curve like the foothills of the Himalayas , looks like I'm getting out of breath !

Many thanks.
Post Reply