Link to home
Start Free TrialLog in
Avatar of ZuZuPetals
ZuZuPetalsFlag for United States of America

asked on

ImageMagick: How resize image to certain width with no pixelation (shrink but not grow)?

I bet ImageMagick can do this but Googling hasn't turned up any easy answers:

Given a source image I want to scale an image DOWN to 600 pixels across but I don't want the image to grow up to 600px.

Examples:
   800px width -> 600px
   600px width -> 600px
   400px width -> 400px (leave at 400... don't pixelate)

Here is my current command line which pixelates:
convert input.jpg -thumbnail 600 output.jpg
What option(s) can I pass to accomplish this?
ASKER CERTIFIED SOLUTION
Avatar of BillDL
BillDL
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Whoops!! REVERSE that > operator to <

The operator is referring to the NEW dimension, not to the dimensions of the original image.  So "greater than" > means "if the NEW dimensions are greater than the original", and the "less than" < means "if the NEW dimensions are less than the original".

Sorry.

Just in case you had expected to see two dimensions specified in the above command eg. "800x600", it is explained in the helpfile that you don't always need both.  In this case I only used the Width dimension and < operator) "x600<" so that large images will be downsized to 600 pixels ON THE WIDTH while scaling the height down to maintain the original aspect ratio

Avatar of ZuZuPetals

ASKER

Thanks!

I found that 600> is the correct geometry.  I think it is > and not <.

Also, I want to enforce width so the "x" is wrong (x implies re-size based on height).
Yes, sorry about that.  I haven't been too good at multi-tasking today.  Tired out and brain-dead.  Thanks for correcting.