Page 1 of 1

Doing crop thumbnail without geometry suffix?

Posted: 2012-02-24T11:43:12-07:00
by ciantic
Hi!

Is it possible to do this:

Code: Select all

convert input.jpg -resize '100x200^' -gravity center -extent '100x200' output.jpg
Without the geometry suffix "^" and still get the same result somehow? Some other options perhaps?

Also I'm lookin a way to do this:

Code: Select all

convert input.jpg -thumbnail '300x300>' output.jpg
Without the geometry suffix ">".

(Some reason geometry suffixes doesn't work through PHP on my computer)

Any help is appreciated, thanks.

Re: Doing crop thumbnail without geometry suffix?

Posted: 2012-02-24T16:42:28-07:00
by fmw42
You will get a different result with ^ than leaving it off. Basically with ^ it resizes according to the smaller dimension. If left off it resizes to the larger dimensions. The latter is more suitable for extending and former to cropping. The > means that the image will only be resized if larger than the size provided. see http://www.imagemagick.org/script/comma ... p#geometry

so if you are trying to resize and pad, then you can leave off the ^. if you are trying to resize and crop, then use the ^.

I don't see why PHP would have any trouble, if the geometry is either properly quoted or the ^,> etc are escaped. Though I don't use it that much. So I will defer to some other users, such as Bonzo, that use PHP more than I. See http://www.rubblewebs.co.uk/index.php

Re: Doing crop thumbnail without geometry suffix?

Posted: 2012-02-26T06:44:37-07:00
by anthony
If you can't use '^' because your IM is too old. Their is a old solution :-) but it involves multiple resizes. :-(

http://www.imagemagick.org/Usage/resize/#space_fill


geometry suffixes should work via PHP, but you may need to double quote time. Once for PHP, and once for the shell PHP runs.

Perhaps a simple PHP example that we could look at?

Re: Doing crop thumbnail without geometry suffix?

Posted: 2012-02-27T11:10:21-07:00
by ciantic
anthony wrote:If you can't use '^' because your IM is too old. Their is a old solution :-) but it involves multiple resizes. :-(

http://www.imagemagick.org/Usage/resize/#space_fill

geometry suffixes should work via PHP, but you may need to double quote time. Once for PHP, and once for the shell PHP runs.

Perhaps a simple PHP example that we could look at?
See and answer my PHP post. I've tried to quote them various ways, no help :/ Thus finding a way to do without suffixes.