Skip to content

Instantly share code, notes, and snippets.

@hawx
Created February 27, 2013 11:53
Show Gist options
  • Save hawx/5047389 to your computer and use it in GitHub Desktop.
Save hawx/5047389 to your computer and use it in GitHub Desktop.
Extends img with a lomo command. Requires imagemagick to generate a mask then adjusts and composes the final image with img.
#!/usr/bin/env sh
function usage {
echo "lomo [options]"
}
function short {
echo "applies a simple lomo effect to the image."
}
function long {
echo " Applies a simple lomo effect to the image, boosting its saturation and
composing with a black edged mask."
}
case "$1" in
--usage ) usage
exit
;;
--short ) short
exit
;;
--long ) long
exit
;;
esac
# Using the method described on:
# http://the.taoofmac.com/space/blog/2005/08/23/2359
# generate a mask using imagemagick
convert -size 80x60 xc:black \
-fill white -draw 'rectangle 1,1 78,58' \
-gaussian 7x15 +matte lomo_mask.png
mogrify -resize 800x600 -gaussian 0x5 lomo_mask.png
# then put it together with img
(
img contrast --ratio 1.2 |
img saturation --ratio 1.2 |
img blend --multiply --fit lomo_mask.png
)
# delete the mask
rm lomo_mask.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment