Skip to content

Instantly share code, notes, and snippets.

@hlorand
Last active April 16, 2016 20:21
Show Gist options
  • Save hlorand/e1a68abd9a4b0547055a4bd2303a7e79 to your computer and use it in GitHub Desktop.
Save hlorand/e1a68abd9a4b0547055a4bd2303a7e79 to your computer and use it in GitHub Desktop.
Generates 360 pieces of image, each image rotated +1 degree (1st: 1degree, 2nd: 2degree ...) - Only OSX
#!/bin/bash
#usage: first parameter is the input image, example: "scipt.sh image.jpg"
WIDTH=$(sips $1 -g pixelWidth | tail -1 | grep -oE '[^ ]+$')
HEIGHT=$(sips $1 -g pixelHeight | tail -1 | grep -oE '[^ ]+$')
NEWWIDTH=$(echo \($WIDTH*1.5\)/1 | bc)
NEWHEIGHT=$(echo \($HEIGHT*1.5\)/1 | bc)
mkdir ~/Desktop/rotated_images
for i in {1..360}
do
sips -r $i -p $NEWHEIGHT $NEWWIDTH $1 --out ~/Desktop/rotated_images/image_$i.jpg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment