I needed to convert many images to another format, and also change their size.
Here’s a page that I found really cool sips tips page. And I used that to convert my HEIC images to jpg images. Other helpful pages: 1, 2.
Say that I have the IMG_2911.jpg
image and I want to have this as .png
. From a terminal in that folder, do:
$ sips -s format png IMG_2911.jpg --out image.png
For the other way around:
$ sips -s format jpeg image.png --out IMG_2911_2.jpg
If I had a list of images in the folder, and want to do this programatically for each one, cd into that folder from the terminal and run:
$ for i in *.HEIC; do sips -s format jpeg "${i}" --out "${i%png}.jpg"; done
Now, if I wanted to change the dimensions of each image to a smaller file size:
$ for i in *.HEIC; do sips -Z 600 -s format jpeg "${i}" --out "${i%png}.jpg"; done