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 largestif 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?
How to use ImageMagick's convert to rescale an image, adding letterboxing to produce a fixed size result?
images;imagemagick;image manipulation
I actually just figured it out: it does require an 800x600 white image to merge with, but that's fine.convert ~/white.jpg ~/input.png  -resize 800x600 -gravity center -composite ~/output.jpgIf there's a general opinion that posting a question and then answering it myself is a waste of time, then i'm happy to delete the question.