I recently upgraded to the latest ImageMagick - 6.8.9, from 6.2.x, and have since noticed some odd things.
The biggest perplexity is in cropping. I am converting a ps file to png, like so:
convert -resize 512x512 -crop 256x256 image.ps image.png
Previously, this created 4 images that were each 256x256. However, now with the latest version, I am getting 9 (3x3) unequally sized dimension images. I am thoroughly confused.
Can someone offer any suggestions?
I've noticed some other differences as well, but this is the one I'm having trouble getting around.
problems since upgrading
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: problems since upgrading
There have been many changes since that very old version.
Syntax ordering is now more logical: read an input, process it, output it. Thus:
Old syntax may work, but don't count on it.
What size is the image after "-resize 512x512"? If it was exactly 512x512, the crop should give four equal-size images. This will happen only if the input is square. To force the resize to be exactly 512x512, use a "!" suffix:
Your shell may need the "!" to be escaped.
See: http://www.imagemagick.org/script/comma ... ptions.php and http://www.imagemagick.org/script/comma ... essing.php etc.
Syntax ordering is now more logical: read an input, process it, output it. Thus:
Code: Select all
convert image.ps -resize 512x512 -crop 256x256 image.png
What size is the image after "-resize 512x512"? If it was exactly 512x512, the crop should give four equal-size images. This will happen only if the input is square. To force the resize to be exactly 512x512, use a "!" suffix:
Code: Select all
convert image.ps -resize 512x512! -crop 256x256 image.png
See: http://www.imagemagick.org/script/comma ... ptions.php and http://www.imagemagick.org/script/comma ... essing.php etc.
snibgo's IM pages: im.snibgo.com
Re: problems since upgrading
Okay, I see.
So, i was successful in creating the equal 4 images like so:
But, that was a simplified version of what I need to do. It looks like when I add in -trim, it doesn't work the way I expect:
I need to trim the white space before resizing. Thanks for your help!
So, i was successful in creating the equal 4 images like so:
Code: Select all
convert sst_graph.ps -resize 512x512 -crop 256x256 sst_graph.png
Code: Select all
convert sst_graph.ps -trim -resize 512x512! -crop 256x256 sst_graph.png
Re: problems since upgrading
I see that I need to add the +repage, since the trim option caries over the original dimensions... I think I"m good now!