I find myself needing to resize images to allow for arbitrary file sizes allowed by some websites. For example, I may take photos that are of resolution X and come out to be 13MB. I need to resize it to be 5MB or less to be allowed on a certain website per their demands.
My workflow is to open the file in Preview, click resize, and then manually “guess” on a size that seems like it would be smaller and iteratively adjust until I hit the size. In preview, it does show what the final file size will be, based on what adjustments to resolution I make, but it only lets me adjust resolution and guess what I need. This is a big waste of time as you can imagine if I have 20+ images to do!
Is there any app that lets me resize an image to be a certain file size and the app calculates the maximum resolution allowed to fall under that size?
Take a look at “ImageMagick” which is a command line program that you can install on your Mac. Search for “ImageMagick mac” to get started. Years ago I used it to do a batch image resize on thousands of photos. Free of charge.
I recall that Adobe’s Lightroom allowed to export images setting a file size upper limit, but it might be a little costly for your needs.
You can batch resize in preview anyway, so you could speed up your workflow without any new app (the article is a little old, but should work nowadays too).
Yep. And before doing this, one must see what it is, install (or confirm already installed) the program, do a little reading of the manual or man file, experiment, etc. Which is why I pointed to how to get started…
But thanks for pointing out the simple command line to do it. Had it occured to me I would have done that!!
FYI, the ImageMagick solution posted by @Lars does not resize the image geometrically, as @GlitterPony’s “by hand” method does. If input.jpg is 4032x3024 pixels, output.jpg will have those same dimensions. It achieves the file size reduction by increasing the JPEG compression. I think the results look good, but you should know what’s happening before applying it to dozens of images.
For a similar need, i created a simple automator script that resizes an image by 50%. The script runs in the finder (right click, select services) so its right where you need it. If the result is still to big, run script again.
Coincidently, today (in all this idle time I now have) I ran across the program which I believe is installed on all Mac’s, the “sips” command. You can run it from a terminal. Type “man sips” to read the manual instructions. Search internet for other guidance. Using “sips jpeg resize” I found https://lifehacker.com/batch-resize-images-quickly-in-the-os-x-terminal-5962420, but there are more.
I haven’t tested or played with it, so you should.
I guess, so far, finding “sips” is my learning of the day.
Runs the AppleScript to resize the files using Sips.
Selects the image files.
Imports the resized files into Photos.
Here’s the complete Applescript:
on run {input, parameters}
repeat with everyDrop in input
set originalFile to quoted form of POSIX path of (everyDrop as text)
tell application "Finder"
set originalName to everyDrop's name
set imageContainer to (everyDrop's container as text)
end tell
set reSizedName to "1080W" & originalName
set outputPath to quoted form of POSIX path of (imageContainer & originalName)
do shell script "sips --resampleWidth 1080 " & originalFile & " --out " & outputPath
end repeat
return input
end run