Chris Green wrote:
What's a quick and easy tool for resizing (as in changing the default screen size) of a Jpeg file?
As with others here I was going to suggest imageMagick, but since they have I won't.
Instead I have a related question: Is there a way with imageMagick (or something else, for that matter, but commandline based) to shoehorn an image into a fixed size and shape, using a specified background colour where the height:width ratio of the image differs from the desired destination size?
Eg: I have a 300x300 box to put a 400x600 image into. It would need reducing to 200x300 (so it fits the 300x300), then centred over (say) a black 300x300 rectangle to create the final image. Ideally the background colour, and alignment over the background, would be optional, but black and centred would normally be fine.
Whenever I've used convert I've been unable to achieve this (I get the 200x300 bit easily, but that's where I get stuck). Given the myriad of options I've never been convinced the option I want isn't lurking there somewhere.
Incidentally, when using these functions from within a web script, it's worth noting that: - Taking an uploaded image (ie uploaded to /tmp somewhere) and moving it to its new home, changing to an image format you're happy with and rescaling it is trivial in a single step with convert and much easier than checking whether a usable JPEG or unsusable TIFF has been uploaded, how big it is, etc. - These tools can usually work from a URL as the source, so you can convert from an online image to a resized converted local image in one step without first downloading it. Therefore we often give the option from the web upload page to enter the URL of an image to use instead of actually uploading it; very little is required in the way of code changes.