Page 1 of 1

Issues with Multiple "convert -extract wxh+x+y"

Posted: 2012-04-23T17:16:35-07:00
by hasso
version 6.7.5-7 on Linux Mint 10

My program extracts a portion of an image using "convert -extract wxh+x+y input.tif interim.tif" syntax, and that gives me the results I am looking for. However, when I subsequently want to extract a portion of interim.tif using the same syntax "convert -extract wxh+x+y interim.tif output.tif", it does not give me the expected results. It either gives me an unexpected output.tif (different location or different size) or doesn't find anything. I think that my program is correct because if I open the interim.tif in GIMP and then resave it as interim.tif, I do get the expected output.tif results. So it looks like ImageMagick must be using some sort of saved property when doing "convert -extract" conversions? Can anyone confirm how I should be doing multiple "convert -extract" conversions (input.tif->convert/extract->interim.tif->convert/extract->output.tif)?

Re: Issues with Multiple "convert -extract wxh+x+y"

Posted: 2012-04-23T18:00:25-07:00
by anthony
Why use -extract?

Use -crop

Code: Select all

  convert input_image -crop WxH+X+Y +repage  -crop WxH+X+Y +repage  save_image
The +repage is important as crop (and probably extract) preserves the virtual canvas (where the image was cropped from).

ASIDE: IMv7 will likely see -crop automatically do a +repage, while +crop (layers crop) does not, for ALL crop operations.
IMv6 +crop just does the same thing as the current -crop

Re: Issues with Multiple "convert -extract wxh+x+y"

Posted: 2012-04-23T18:10:29-07:00
by hasso
OK.. I'll give -crop a try and report back. Although I omitted it in my post, I did have a +repage in my "convert -extract" syntax so would have expected it to work.