Imagemagick Resize Rule

These are some pattern codes for resize using Imagemagick

Pattern 1 (resize to 960×550 px)
( Original size width > Target size width ) and (Original size height > Target size height) and ( (Original size width / Original size height) > (Target size width / Target size height)

pattern1

convert [original.jpg]  -resize x550 -gravity center -crop 960×550+0+0 +repage [result.jpg]
or
convert [original.jpg] -resize x550^ -gravity center -extent 960×550 [result.jpg]

Pattern 2 (resize to 960×550 px)
( Original size width > Target size width ) and (Original size height > Target size height) and ( (Original size width / Original size height) < (Target size width / Target size height)

pattern2

convert [original.jpg]  -resize 960x^ -gravity center -crop 960×550+0+0 +repage [result.jpg]
or
convert [original.jpg] -resize 960x^ -gravity center -extent 960×550 [result.jpg]

Continue reading “Imagemagick Resize Rule”

Imagemagick Resize Rule