Skip to content

Instantly share code, notes, and snippets.

@sergiolopes
Created January 31, 2012 03:56
Show Gist options
  • Save sergiolopes/1708679 to your computer and use it in GitHub Desktop.
Save sergiolopes/1708679 to your computer and use it in GitHub Desktop.
Shows lossy compression of a JPEG file. It just rotates an image 180 degrees a couple times. Using 100% quality it's still a lossy format.
#/bin/bash
# Params:
# - original filename
# - number of 180 degrees rotations
cp $1 degradated.jpg
for ((i=1; i <= $2 ; i++)); do
convert degradated.jpg -quality 100 -rotate 180 temp.jpg
mv temp.jpg degradated.jpg
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment