Skip to content

Instantly share code, notes, and snippets.

@dymio
Created June 3, 2014 14:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save dymio/8af33033186b9011a7f7 to your computer and use it in GitHub Desktop.
Save dymio/8af33033186b9011a7f7 to your computer and use it in GitHub Desktop.
#!/bin/sh
# Imagemagick analogue of Adobe Photoshop Gradient map with 75% opacity on it
# you will need the input.jpg file with original color image
# and gradient_line.png file with 256 x 1 px image of gradient
# make image grayscale
convert input.jpg -colorspace gray draft.jpg
# apply the gradient lut
convert draft.jpg gradient_line.png -clut draft.jpg
# set 75% opacity
convert draft.jpg -alpha on -channel a -evaluate set 75% draft.png
# impose result image on original image
convert the_in.jpg temp.png -gravity center -composite -format jpg -quality 90 output.jpg
# remove temporary files
rm draft.jpg && rm draft.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment