Thursday, January 1, 2015

Image Magick Bash Alias to Stipple Photos (like the WSJ)

alias stipple='_(){ if [[ ! -f "${1}" ]]; then echo "File does not exist: ${1}"; else TMPMAPF="/tmp/_stipple_map.png"; convert xc:White xc:Black -append "${TMPMAPF}"; FILEEXT="${1##*.}";FILENM="${1##*/}"; FILENM="${FILENM%.*}"; FILEPATH="$(dirname ${1})"; convert "${1}" -modulate 100,0,100 +level 30%,90% -remap "${TMPMAPF}" "${FILEPATH:-.}/${FILENM}_stipple.${FILEEXT}"; firefox "${FILEPATH:-.}/${FILENM}_stipple.${FILEEXT}"; fi }; _'
(To use this alias you need to have Image Magick installed: sudo apt-get install imagemagick)

2 comments:

  1. Thanks! This is interesting. However I'm stuck with probably copy-paste error, since I get
    > to next line after stillpe file.jpg. Would you copy this to pastebin?

    ReplyDelete
    Replies
    1. Try again, there was a space after the equal sign because of the html being segmented. It seems to be gone now.

      Delete