Skip to content

Instantly share code, notes, and snippets.

@arvearve
Forked from lelandbatey/whiteboardCleaner.md
Last active August 29, 2015 13:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arvearve/9951162 to your computer and use it in GitHub Desktop.
Save arvearve/9951162 to your computer and use it in GitHub Desktop.

Description

This simple function will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

    function whiteboard(){
        convert $1 -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1  "${@:2}"     ${1%.*}.png
    }

Usage

Add to your .zshrc or .bashrc, and call it with whiteboard <input image> <optional additional ImageMagick args> Outputs <input_filename>_cleaned.png

Here's an example:

whiteboard example1.jpg would output a cleaned version called example1_cleaned.png

Results

Here are some of the input images:

And here are the results:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment