resize to make a JPG *bigger* (surround with whitespace)
Posted: 2017-05-19T11:42:57-07:00
Hi friends,
I want to take an arbitrary hi-res JPG (say 4000 x 3000 pixels) and make its pixel size *larger* while *changing its aspect ratio*. The new JPG must exactly match the aspect ratio of a particular print size, say 10x8.
For example, 4000x3000 native JPG printed to 10"x8" using shrink-to-fit logic... 10x8 == 40x32 == 4000x3200 so I take my original JPG 4000x3000 and add two white strips 100px wide to either side of the short dimension, so final JPG is grown 4000x3200. But how to best do this?
The larger JPG will be submitted to be printed automatically by one of ~20 print labs, whose APIs don't offer shrink-to-fit and are unlikely to, so we want to build a JPG ourselves, done right, and submit that. The end-customer will be paying in some cases $100's per print so preserving quality is important... my earlier tests of creating a blank white 4000x3200 JPG and then stacking the original atop that raised concerns because the final JPG was so much smaller in bytes than our original, and the final JPG had the null metadata of my blank 4000x3200, rather than the IPTC/Exif/XMP of the original. I suspect the original metadata might include hints like colorspace which are needed to produce the best possible print.
I guess I'm looking for ideas on how to grow the original JPG by N white pixels in a particular dimension, so the final JPG is of same or larger byte size, and preserves its original metadata & internal JPG data as much as possible. Ideas? Something like:
mogrify original.jpg -resize 4000!x3200! -fill white
Thanks in advance,
R
I want to take an arbitrary hi-res JPG (say 4000 x 3000 pixels) and make its pixel size *larger* while *changing its aspect ratio*. The new JPG must exactly match the aspect ratio of a particular print size, say 10x8.
For example, 4000x3000 native JPG printed to 10"x8" using shrink-to-fit logic... 10x8 == 40x32 == 4000x3200 so I take my original JPG 4000x3000 and add two white strips 100px wide to either side of the short dimension, so final JPG is grown 4000x3200. But how to best do this?
The larger JPG will be submitted to be printed automatically by one of ~20 print labs, whose APIs don't offer shrink-to-fit and are unlikely to, so we want to build a JPG ourselves, done right, and submit that. The end-customer will be paying in some cases $100's per print so preserving quality is important... my earlier tests of creating a blank white 4000x3200 JPG and then stacking the original atop that raised concerns because the final JPG was so much smaller in bytes than our original, and the final JPG had the null metadata of my blank 4000x3200, rather than the IPTC/Exif/XMP of the original. I suspect the original metadata might include hints like colorspace which are needed to produce the best possible print.
I guess I'm looking for ideas on how to grow the original JPG by N white pixels in a particular dimension, so the final JPG is of same or larger byte size, and preserves its original metadata & internal JPG data as much as possible. Ideas? Something like:
mogrify original.jpg -resize 4000!x3200! -fill white
Thanks in advance,
R