Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

It wasn't me

macrumors newbie
Original poster
Jun 12, 2013
6
0
Hello wonderful wonderful community!

Any good way to fix FILE size for a batch of images?
I don't care about pixel size, just FILE size.

I need to resize all pictures in a folder to (eg) 500kb but all Googlefoo sends me to Preview, Adjust size. Thats not what I want because that results in file size variations. I can't find the solution in Automator either. How to fix file size on a batch of images?

Thoughts and experiences welcomed.
thanks all!
 
Hi
Open ones in Preview > Cmd +A > Tools > Adjust Size

Works for me

Or maybe there're some specific extensions that may cause that?
 
Hi
Open ones in Preview > Cmd +A > Tools > Adjust Size

Works for me

Or maybe there're some specific extensions that may cause that?
It's pretty clear he's NOT trying to resize the images. You're telling him to do exactly what he doesn't want to do (adjust the dimensions of the images). He wants to make sure the file size is the same when you view it in the Finder (so for example: he wants 4 images that are 500kb, 600kb, 700kb and 800kb to all be 500kb).
 
Last edited:
  • Like
Reactions: It wasn't me
Any good way to fix FILE size for a batch of images? I don't care about pixel size, just FILE size.

I need to resize all pictures in a folder to (eg) 500kb but all Googlefoo sends me to Preview, Adjust size. Thats not what I want because that results in file size variations. I can't find the solution in Automator either. How to fix file size on a batch of images?
Unfortunately, you're going to find that this is virtually impossible because the file size is determined by the quality, dimensions and resolution of the image itself. In order to batch adjust this, you would end up with a folder full of images that are all different dimensions, levels of compression and resolution – and even if you didn't care about that, it's unlikely you could get them to be that precise in file size.

Getting even a small handful of images to be exactly 500kb just isn't going to happen for you.
 
  • Like
Reactions: appltech
you can use for example imagemagick for this. the included mogrify provides an extent-flag to define the maximal file size for the conversion.

E.g. mogrify -define jpeg:extent=500kb *.JPG will convert each JPEG in the current folder to a new, maximal 500kb JPEG.

You can integrate this nicely with e.g. Automator, Applescript or Shortcuts on your Mac.
 
That's a wonderful clue and great direction. Thank you Slartibart. I'm sure that will do the job.
Now I just need to work out how to deploy it. o_O

Imagemagick is installed in Homebrew but I'm still fighting it from Automator. Anyway - thanks - great direction.
 
Write a shell script, something like:

#!/bin/bash for i in *.png; do mogrify -format jpg -define jpeg:extent=500kb -quality 100 "$i" "${i%.png}.jpg" done

(looks for all PNG in current folder and uses mogrify to convert them to JPG with max. filze = 500kb and max. quality, keeping the original name).

make sure that $PATH includes your imagemagick installation. Use the run shell script- option in Automator (or Shortcuts). Or e.g. use Platypus and drag and drop the files you want to convert simply on the icon of the app it created from your script.
 
  • Like
Reactions: arw
Wait a second... you said they must be 500kb. As in EXACTLY 500kb. Are you saying that 500kb is just the maximum size? If that's the case, the problem is a lot easier to solve.
 
For those with Adobe CC subscription, you can use Adobe Bridge:
  1. In Bridge load all the images into Camera Raw (right-click and Open in Camera Raw...)
  2. In Camera Raw click Save Images in the bottom left corner
  3. In the dialog box that opens you can limit file size (see very bottom of dialog box)
 
  • Like
Reactions: arw and Slartibart
Thanks people!
I'd settle with 500kb being the maximum size if thats easier?

(still working on how to make the Slartibart suggestion work without error here. Yeah - Its my learning curve!)
 
Another option is provided by Graphicconverter -> if you use its Convert & Modify-function, there is a Resize to Reach File Size-option you can apply for single or batch conversions. It’s shareware, so you can easily test - worth ever cent IMHO 🤓.

The solution provided by @MacGizmo via Adobe Bridge does not require a CC subscription - probably? I do not know for the latest version of Bridge, but previously it was the one Adobe program which is not impacted by the subscription requirement… and it still seems to be a free unrestricted download.
 
For jpeg files, jpegoptim https://github.com/tjko/jpegoptim
Code:
jpegoptim -q -s -S 500 /path/to/jpeg/image.jpg

Automator - QuickAction
jpegoptim.jpg
 
  • Like
Reactions: arw
For those with Adobe CC subscription, you can use Adobe Bridge:
  1. In Bridge load all the images into Camera Raw (right-click and Open in Camera Raw...)
  2. In Camera Raw click Save Images in the bottom left corner
  3. In the dialog box that opens you can limit file size (see very bottom of dialog box)
Wow. Any idea how to get the same feature/preset to show up in Bridge's Export settings? In Camera Raw I successfully created a preset but neither the file-size limit option not the preset shows up in Bridge.
On the other hand, @bogdanw 's tip jpegoptim looks more leightweight.
EDIT: jpegoptim offers better visual quality at the same file size compared to a Photoshop export, so I will look into that more closely, THANKS!
EDIT2: a shame one can't feed tif files as source but only already compressed jpegs
 
Last edited:
Thanks @Approved and @bogdanw , but what I meant was, I‘d like to prevent a double lossy conversion. Meaning not
source tiff > jpg (max quality) > jpg (limited file size) but straight
source tiff > jpg (limited file size)
Also, jpegoptim messes with the color profile, even with —strip-none
I will have a look at @Slartibart ’s tip mogrify.
 
Last edited:
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.