I hardly ever use ImageMagick, excellent tho it is, so I hope that people will bear with me if I'm asking a silly question.
I want to reprint an old book on lulu.com. I've scanned the pages as images (jpgs). But each image is smaller than the page size that lulu want.
What this means is that lulu resize the image to fill the space, which distorts it.
What I want to do is to put whitespace all the way around the image, to fill it out to the size (in inches or cms) that I need. In this way the image of the page text will remain the same size, but the actual file will be larger.
Can anyone tell me how best to do this? I saw the -border, but this seemed to involve me specifying the width of the border, rather than the end-size of the image.
Suggestions very welcome.
All the best,
Roger Pearse
Adding whitespace around an image to make it the right size
Re: Adding whitespace around an image to make it the right size
Why don't you just create a blank white image the correct size and put your other image onto it?
You will need to work out the size but when you have it correct it will work for all the pages.
Code: Select all
convert -size 400x600 xc:white page.jpgs -gravity center -composite output.jpgs
Re: Adding whitespace around an image to make it the right size
Ah! Yes, of course that would work, wouldn't it?! Thank you for the syntax -- I'll try that.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Adding whitespace around an image to make it the right size
There are about a dozen methods you can use for 'padding' an image. The above are the two best methods... See
http://imagemagick.org/Usage/thumbnails/#pad
http://imagemagick.org/Usage/thumbnails/#pad
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: Adding whitespace around an image to make it the right size
Thank you also -- ah, I knew it had to be an FAQ!
Roger
Roger