Batch Convert PNG to JPG from Mac Terminal

Batch Convert PNG to JPG

mkdir jpegs; sips -s format jpeg *.* --out jpegs

Batch Convert JPG to PNG

mkdir pngs; sips -s format png *.* --out pngs

About Mac sips command

What do these commands do?
mkdir just makes a new folder
sips -s format: sets the format you want to change the files to

—out: sets the directory you want to save the converted files to

How to batch resize image files from Mac Terminal

Resizing images with sips
Batch resizing images is super easy and fast using the Mac OSX terminal and the sips command.

Here’s an example:
sips -Z 640 *.jpg

Check Image Dimensions

 sips -g pixelHeight -g pixelWidth *

This command will print the height and width of every image in the directory.

About sips Scriptable Image Processing System

sips 10.4.4 – scriptable image processing system.
This tool is used to query or modify raster image files and ColorSync ICC profiles.
Its functionality can also be used through the “Image Events” AppleScript suite.

Usages:
sips [-h, –help]
sips [-H, –helpProperties]

sips [image-query-functions] imagefile …

sips [profile-query-functions] profile …

sips [image modification functions] imagefile …
[–out result-file-or-dir]

sips [profile modification functions] profile …
[–out result-file-or-dir]

Profile query functions:
-g, –getProperty key
-X, –extractTag tag tagFile
-v, –verify

Image query functions:
-g, –getProperty key
-x, –extractProfile profile

Profile modification functions:
-s, –setProperty key value
-d, –deleteProperty key
–deleteTag tag
–copyTag srcTag dstTag
–loadTag tag tagFile
–repair

Image modification functions:
-s, –setProperty key value
-d, –deleteProperty key
-e, –embedProfile profile
-E, –embedProfileIfNone profile
-m, –matchTo profile
-M, –matchToWithIntent profile intent
–deleteColorManagementProperties
-r, –rotate degreesCW
-f, –flip horizontal|vertical
-c, –cropToHeightWidth pixelsH pixelsW
-p, –padToHeightWidth pixelsH pixelsW
–padColor hexcolor
-z, –resampleHeightWidth pixelsH pixelsW
–resampleWidth pixelsW
–resampleHeight pixelsH
-Z, –resampleHeightWidthMax pixelsWH
-i, –addIcon

Apple Documentation