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)
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)
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]
Pattern 3 (resize to 900×900 px)
( Original size width > Target size width ) and (Original size height < Target size height)
convert [original.jpg] -size 900×900 xc:#141414 +swap -gravity center -composite [result.jpg]
Pattern 4 (resize to 1200×900 px)
( Original size width < Target size width ) and (Original size height > Target size height)
convert [original.jpg] -size 1200×900 xc:#141414 +swap -gravity center -composite [result.jpg]
Pattern 5 (resize to 300×300 px)
( Original size width < Target size width ) and (Original size height < Target size height)
convert [original.jpg] -size 300×300 xc:#141414 +swap -gravity center -composite [result.jpg]
Yes, 5 patterns 😀
I hope you enjoy this example of using imagemagick resize rule 😀
buat apa sih An kek ginian.. Ra mudheeeeng hahahaha
haha ini salah satu library resize image di java mba 😀