2

I would like a quick/simple way to use SIPS to resize images to the sizes I want.

Currently- I have to do each file one-by-one, including runnings the sips command, then renaming the file and copying it to another directory.

Ideally- I could automate this to work like the following.

In terminal:

sips -Z 500 *.png

rename the FILENAME_500x.png

sips -Z 1000 *.png

rename the FILENAME_1000x.png

sips -Z 1500 *.png

rename the FILENAME_1000x.png

Yian
  • 189
  • 14

1 Answers1

1

Define this function in your shell:

function resize() {for f in *.png; do sips -Z "$1" "$f"; mv "$f" "${f/.png/_$1x.png}"; done }

Then change current directory to where you want to resize images:

cd YourFolderContainsPNGFiles

Finally invoke resize function like this:

resize 500

For different pixelsWH change the argument:

resize 1500

The function resizes all *.png files in the current folder with the given argument and then appends _pixelWH to the file name.

Hamid Rouhani
  • 2,309
  • 2
  • 31
  • 45