MacOS preview application provides a very easy way to convert and process images if you want a quick way to convert a few images. This article by MacRumors describes an easy way to achieve it.

This becomes a problem if you ever want to convert large number of images. Opening thousands of images and then converting them using preview will mostly end up hanging mac for saveral minutes.

There is however a very handy command line utility called sips that comes built-in macOS and provides an easy way to convert thounsands of images in efficient manner.

Command Structure

To convert single file with sips, here is command syntax:

sips -s format [image type] [file name] --out [output file]

For example if you want to convert file named test.png, here is sips syntax:

sips -s format jpeg test.png --out test.jpg

Batch Convert

This command does not take multiple inputs but it's super easy to convert multiple files with shell scripting:

for i in *.png; do sips -s format jpeg $i --out Converted/$i.jpeg;done

Convert to HEIF / HEIC

It's also possible to convert all jpeg images to HEIC to save space before storing them. HEIC images will be 30-50% smaller for same quality as JPEG.

for i in *.jpg; do sips -s format heic -s formatOptions 75 $i --out converted/$i.heic;done

This command will convert images to heic and put converted images to "converted" folder. Here, the formatOptions argument sets output quality for the image. Value of 0 means most compressed and 100 means lossless.

Supported Formats

Sips supports large number of image formats. Here is table on supported formats.

Format Read / Write
pdf Writable
psd Writable
icns Writable
gif Writable
exr Writable
bmp Writable
dds Writable
ico Writable
tga Writable
astc Writable
ktx Writable
heic Writable
heics Writable
jpeg Writable
jp2 Writable
pbm Writable
png Writable
pvr Writable
tiff Writable
dng Read
pict Read
cr2 Read
cr3 Read
crw Read
dxo Read
erf Read
raf Read
3fr Read
fff Read
dcr Read
mrw Read
mos Read
raw Read
rwl Read
nrw Read
nef Read
orf Read
orf Read
orf Read
raw Read
rw2 Read
pef Read
iiq Read
srw Read
sgi Read
arw Read
srf Read
sr2 Read
webp Read
avci Read
heif Read
mpo Read
pic Read