[magick-users] Thumbnails with center auto crop

David Di Biase dave.dibiase at gmail.com
Sat Feb 16 12:49:03 PST 2008


Hi there,

I have a quick issue regarding cropping and centering images. I apologise if
this seems simple, but the question is can I do this without scripting and
if so how exactly?

I have a range of images:

http://photos.vfxy.com/themes/images/72008/1.jpg
http://photos.vfxy.com/themes/images/72008/2.jpg
http://photos.vfxy.com/themes/images/72008/9.jpg

I don't expect any images less than 200x200 total resolution. I'm looking to
generate a 180x130 thumbnail for each image, but the command I'm using now:

convert {$tname}! -filter Lanczos -thumbnail '180x130>' {$tname}m.jpg

Retains the aspect ratio, of course. I'm trying to find a way to determine
the maximum crop size in the center of the image and reduce the image to the
180x130 without distorting it. I realize that this is kind of crappy
considering that the user doesn't have the option to directly specify the
crop zone...but I need something temporarily to create an auto crop of the
image.

I was looking at the documentation and there's some options like using %
crops, but the image size is always different, so I'm not quite sure. My
best guess would be to define a crop then use gravity to center the image,
produce a draft crop version then reduce that aspect ratio-ed version.

Hehe,

Help. :-)


More information about the Magick-users mailing list