I have some arbitrarily-sized images for which I want to produce fixed-size 800x600 thumbnails, which keep the original image ratio and add white letterboxing to make up the rest of the space. I'd like the letterboxing to be as minimal as possible, which means that the process would do the following:
- choose whichever axis is largest
- if x is largest, scale the image (keeping the ratio) so that new x is 800.
- if y is largest, scale the image (keeping the ratio) so that new y is 600.
- the result, at this point, will not be 800x600 (unless the original happened to be exactly 4:3 ratio), so centre the result in an 800x600 rectangle and add a white background.
I can do the first 3 steps with
convert -resize 800x600 $input $output so I suppose I could overlay that on top of another image using some other imagemagick tool, but it would be great if I could do it in one hit. Anyone know if this is possible?