Hello,
I have a bunch of (scan) jpegs, which have different pixel resolutions and display ratios.
for instance 730x1080, 764x1080, 2059x2912
I which to convert all of them to A4 format, aka 210x297 in whatever sufficient dpi.
It means that some jpeg, do need some white borders on their width, or on their top&bottom borders, in order to output in A4 format.
Border(http://www.imagemagick.org/Usage/crop/#border) could do it if I indivually count for every scan, but here in a batch process I do not know which input ratio I have for each image.
Additionnaly, I wish to resize the longest side to a specific pixel size, say 1200, so that all output have same dpi.
How can I do that?
Thanks
How to batch resize to a specific aspect ratio by adding white borders
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to batch resize to a specific aspect ratio by adding white borders
LOok at the examples in Thumbnails, Padding Images
http://www.imagemagick.org/Usage/thumbnails/#pad
However if you are not after a specific size just a specific ratio. That can be trickier.
See 'Squaring an image' whcih is very simular to what you are after.
http://www.imagemagick.org/Usage/thumbnails/#square
You just need to adjust the 'math' to set the width to height ratios.
http://www.imagemagick.org/Usage/thumbnails/#pad
However if you are not after a specific size just a specific ratio. That can be trickier.
See 'Squaring an image' whcih is very simular to what you are after.
http://www.imagemagick.org/Usage/thumbnails/#square
You just need to adjust the 'math' to set the width to height ratios.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: How to batch resize to a specific aspect ratio by adding white borders
Additional...
This is also related.. Rotate with internal crop Preserving Aspect Ratio
http://www.imagemagick.org/Usage/distor ... te_methods
This is also related.. Rotate with internal crop Preserving Aspect Ratio
http://www.imagemagick.org/Usage/distor ... te_methods
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/