Skip to content

Instantly share code, notes, and snippets.

@thaJeztah
Forked from lelandbatey/whiteboardCleaner.md
Created August 5, 2016 11:02
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thaJeztah/632c8726376eb892a11a02e9c57c4dd9 to your computer and use it in GitHub Desktop.
Save thaJeztah/632c8726376eb892a11a02e9c57c4dd9 to your computer and use it in GitHub Desktop.
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script 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:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

Here are some of the input images:

And here are the results:

Usage

Assuming it's saved as a file named whiteboardClean.sh, the command is ./whiteboardClean.sh {name of input file} {name of file to output to}.

Here's an example:

./whiteboardClean.sh example1.jpg output1.png

How I Came Up With This

I was doing a lot work with whiteboards and I'd been taking pictures of them to document what had been written. I wanted a more clean version of the pictures though, something that captured the essence of what a whiteboard image showed.

Eventually I found this excellent guide to cleaning up whiteboard photos using GIMP. However, I found I wanted more automation. So, I spent a few hours yesterday figuring out how to do the same thing using ImageMagick from the command line and made this script.

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