Doing crop thumbnail without geometry suffix?

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
ciantic
Posts: 8
Joined: 2011-05-07T08:46:43-07:00
Authentication code: 8675308

Doing crop thumbnail without geometry suffix?

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Doing crop thumbnail without geometry suffix?

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Doing crop thumbnail without geometry suffix?

Post 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?
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
ciantic
Posts: 8
Joined: 2011-05-07T08:46:43-07:00
Authentication code: 8675308

Re: Doing crop thumbnail without geometry suffix?

Post 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.
Post Reply