Page 1 of 1

crop and extact to png

Posted: 2012-01-03T11:08:20-07:00
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

Re: crop and extact to png

Posted: 2012-01-03T11:26:02-07:00
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

Re: crop and extact to png

Posted: 2012-01-03T13:20:19-07:00
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".

Re: crop and extact to png

Posted: 2012-01-03T14:30:42-07:00
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.

Re: crop and extact to png

Posted: 2012-01-03T14:39:42-07:00
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.