Saturday, April 30, 2016

Using sips on MacOS to do stuff with images

I want to rotate a jpg by a set number of degrees...

For tips on using "sips", (link)
And link to smittytone's big bash script for batch processing image files (installed using homebrew). 

You can manipulate images from the command line e.g.
sips -r 359.5  --padColor FFFFFF TheBaily.jpg
Nudges the image 359.5 degrees clockwise (effectively 0.5 degrees anti-clockwise) and fills the empty space white (FFFFFF).
From Stackexchange (link) and the Apple man page for sips (old link, no longer active :-(.

For more tips on doing image editing on Macintosh OS X using the image editor... (link)

I want to bulk resize images

(manual instructions courtesy of Birme.net - link)
Launch Terminal. 
To resize a single image width "sample-image.jpg" into 1200px and save as "resized-image.jpg". 
sips --resampleWidth 1200 sample-image.jpg --out resized-image.jpg

Or to restrict height, change --resampleWidth into --resampleHeight 
sips --resampleHeight 1200 sample-image.jpg --out resized-image.jpg

To bulk resize multiple images, set the input image as a file name pattern, such as all jpg files: *.jpg. Before running the resizing code, create a target folder like resized to hold all the resized images. 
sips --resampleHeight 1200 *.jpg --out resized

You can add additional parameters to set the compression quality of jpeg images like this: 
sips -s formatOptions 80 --resampleHeight 1200 *.jpg --out resized

You can use this parameter convert all png files into jpeg files 
sips -s format jpeg -s formatOptions 80 --resampleHeight 1200 *.png --out resized

Sharing 360° video?

So, you've got a 360 degree video file from your GoPro. What to do with it? Well, share it on YouTube. YouTube supports uploading and pl...