problems since upgrading

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
barells
Posts: 3
Joined: 2014-10-22T12:25:25-07:00
Authentication code: 6789

problems since upgrading

Post by barells »

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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: problems since upgrading

Post by snibgo »

There have been many changes since that very old version.

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
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:

Code: Select all

convert image.ps -resize 512x512! -crop 256x256 image.png
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.
snibgo's IM pages: im.snibgo.com
barells
Posts: 3
Joined: 2014-10-22T12:25:25-07:00
Authentication code: 6789

Re: problems since upgrading

Post by barells »

Okay, I see.

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
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:

Code: Select all

convert sst_graph.ps -trim -resize 512x512! -crop 256x256 sst_graph.png
I need to trim the white space before resizing. Thanks for your help!
barells
Posts: 3
Joined: 2014-10-22T12:25:25-07:00
Authentication code: 6789

Re: problems since upgrading

Post by barells »

I see that I need to add the +repage, since the trim option caries over the original dimensions... I think I"m good now!
Post Reply