Magic formula for reducing images to exact file size

Started 1 month ago | Discussions thread
NAwlins Contrarian Senior Member • Posts: 2,172
Re: Limit to exact file size because ...

I need to resize some large images so that they are as close to 20MB as possible without exceeding 20MB.

Why you need to do this ?

Usually because you're submitting an image to some site or user with an arbitrary limit on file size, and you want to pack as much quality into the available file size limit as possible.

In my experience, such "arbitrary" file size limits are very flexible ....

In my experience, many of them are not. I have uploaded photos to multiple places that had file-size limits on photos, and would automatically reject my upload attempts if I exceeded them to any degree.

I have no idea of the particulars of the OP's real or perceived need, but I've had the same need myself (except 20 MB would be quite large compared to the limits I've hit).

Given that there's considerable variation in JPEG file sizes (for particular pixel dimensions), it would be normal practice to specify 15Mb as a maximum and accept anything between 10Mb and 15Mb (and that would cover most of my JPEGs).

The OP's requirement of "all files as close as possible to 20Mb" is hardly normal practice, but I guess we'll never know the reason.

You're right that most people wanting JPEGs as close as possible to, but not exceeding, 20 MB would probably be fine with 15 MB. If what you're saying is that usually there's very little to no visible difference between a 15 MB JPEG and a 20 MB JPEG, then I agree--and would add that the same probably goes for a 10 MB JPEG. The OP is referring specifically to 20 MP images, so the 'full' file size at 24 bits is a bit under 57 MB. In my experience even the very highest JPEG quality settings almost always get you 2:1 compression, so 28 MB is about the biggest JPEG I could make from a 20 MP image. And even 10:1 compression JPEGs can look very good, so I bet going down to 6 MB would produce good-looking files in many cases. At 5:1 compression, i.e. a 20 MP JPEG of 11 MB, I think the large majority of us would be unable to reliably pick out the file from an otherwise-identical TIFF.

But hey, sometime people have stupid, arbitrary requirements. And sometimes the best way to get through a particular slice of life is to comply with some such requirements. Hence my other reply (about Lightroom), hoping to help the OP.

 NAwlins Contrarian's gear list:NAwlins Contrarian's gear list
Nikon Coolpix S30 Canon PowerShot S110 Sony Alpha DSLR-A580 Tamron SP AF 90mm F/2.8 Di Macro Tamron SP 70-300mm F/4-5.6 Di USD +5 more
Keyboard shortcuts:
FForum PPrevious NNext WNext unread UUpvote SSubscribe RReply QQuote BBookmark MMy threads
Color scheme? Blue / Yellow