Friday, 14 October 2011

OSX Command line image editing

If you are away from home, or just need some very light weight image processing here's two that are useful:

increasing jpeg compression because your connectivity is not so good, use 'sips'. Its built into OSX

    sips --setProperty formatOptions normal 1.jpg

or, for all images in a folder

    sips --setProperty formatOptions normal *

    sips --setProperty formatOptions normal *

SIPS can also take a % for finer control


    sips --setProperty formatOptions 30 *

If you want to use lossles rotation, the get nconvert from http://www.xnview.com/en/features_nc.html

Assuming you leave it in your downloads folder then the command to rotate 90 degrees anti-clockwise would be

    ~/Downloads/NConvert/nconvert -overwrite -jpegtrans rot90 1.jpg


After these, you'll find the date/time stamp of your files is wrong, so use jhead to put them back. First get it from http://www.sentex.net/~mwandel/jhead/

then the command would be

    ~/Downloads/jhead/jhead -ft *.jpg
    ~/Downloads/jhead/jhead -ft *.JPG

you'll note that its case sensitive.

No comments:

Post a Comment