Sips - Scale pictures to specified mb

Sips offers no commands to up/downsample pictures to a specified size in mb.
So I had to play with pixels.

… Does the job, if I want a 1 MB picture from a smaller sized picture (e. G. 2560x1600) , which was already compressed at a rate of 80-90% “normal”
I’d love to instruct my script dynamically what the target file size my picture has to have in MB
I found this site : toolstud.io
Any chance to transcribe it into AS? :smiley:

I made an AppleScript to compress JPEG picture to target file size.

http://piyocast.com/as/archives/5492

This script try to make an image with each compression rate jpeg image on memory and get the image data size.

How about this?

Model: MacBook Pro 2012
AppleScript: 2.7
Browser: Safari 13.0.1
Operating System: macOS 10.14

if you’re talking jpeg files, it’s all largely guess-work – the amount of compression depends on the image content. The only accurate way is trial-and-error.