On 18-Mar-09 12:12:03, Mark Rogers wrote:
Any experts in using ImageMagick lurking?
I need to resize an image to fit into a 350x350 box. Which means I need to (a) scale the image so no dimension exceeds 350, then (b) centre the image in a 350x350 canvas.
Eg for a 700x600 image, (a) creates a 350x300 image which (b) then converts to 350x350 without distorting it (by adding "whitespace".
Ideally I want some control over what the canvas colour ("whitespace") will be, in particular transparent would be a good option, but white will do for now.
The first bit is easy: convert -resize 350x350 old.png new.png I've tried various ways to do step (b) without success. (A single command which does both would be best, but two separate commands would be a start!)
-- Mark Rogers // More Solutions Ltd (Peterborough Office) // 0845 45 89 555 Registered in England (0456 0902) at 13 Clarke Rd, Milton Keynes, MK1 1LG
Have a look at 'montage' (part of the InageMagick package). While it is usually used for making a true montage out of several separate images, there is nothing to stop you using it for just one.
The options will allow you to do things like placement, borders, etc.
montage -help
lists the options.
Hpoing this helps! Ted.
-------------------------------------------------------------------- E-Mail: (Ted Harding) Ted.Harding@manchester.ac.uk Fax-to-email: +44 (0)870 094 0861 Date: 18-Mar-09 Time: 12:31:10 ------------------------------ XFMail ------------------------------