Skip to content

Instantly share code, notes, and snippets.

@julianduque
Created June 14, 2012 16:08
Show Gist options
  • Save julianduque/2931214 to your computer and use it in GitHub Desktop.
Save julianduque/2931214 to your computer and use it in GitHub Desktop.
Bash script for resize and set quality to jpg images (works with sips on Mac OSX)
#!/bin/bash
for file in *.jpg
do
sips --resampleHeightWidthMax 1357 --setProperty formatOptions 80 $file
done;
@Integralist
Copy link

Amazing! Thank you for sharing this

@gianpaj
Copy link

gianpaj commented Jun 3, 2018

you can also do:

sips --resampleHeightWidthMax 1357 --setProperty formatOptions 80 *.jpg

@trevorr
Copy link

trevorr commented Aug 28, 2019

With multiple subdirectories and spaces in filenames:

find . -name '*.jpg' -print0 | xargs -0 -L 1 sips --resampleHeightWidthMax 1357 --setProperty formatOptions 80

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment