Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!


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:

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


Here are some of the input images:

And here are the results:


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

Here's an example:

./ 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.

Copy link

henrebotha commented May 22, 2018

@bruceathome did you manage? I can try and help you. Drop me an email (address here

Copy link

Bersaelor commented May 24, 2018

Next step:
Replicate same line with CIFilters and put it in an app, so you don‘t have to export them to PC first.

Copy link

yekm commented May 24, 2018

Copy link

luisDVA commented Jun 2, 2018

has anyone here used this workflow in the 'magick' package in R?
I can't replicate the last bit because I can't figure out how the -level operator was implemented

Copy link

moontecholabs commented Sep 10, 2018

Hello everyone,

Anyone know how to apply this Whiteboard script for swift or objective C Or any other way to use in iOS?

Copy link

john-dgi-vof-com commented Jan 24, 2019

oooh wauwie !!! I have been looking for this method for hundreds of years ;-) thanks man!!

Copy link

Deliaz commented Feb 27, 2019

Hello everyone,

Anyone know how to apply this Whiteboard script for swift or objective C Or any other way to use in iOS?

Let me know please, If you will find anything. Thanks.

Copy link

bwjohnson-ss commented Aug 8, 2019


Copy link

Napolitain commented Sep 25, 2019

I'm getting an error :

convert: ../../magick/quantum.c:216: DestroyQuantumInfo: Assertion `quantum_info != (QuantumInfo *) NULL' failed. line 2:     9 Aborted                 (core dumped) convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

I use Ubuntu WSL for Windows 10 and installed the library obviously (ImageMagick). I tried it on a 32000*27000 png image (max format for PNG fyi).

I would also prefer to use it on my initial PDF but it seems it does not work?

Copy link

Napolitain commented Sep 25, 2019

Okay, the PNG error is not corrected but I finally found out how to use it on my PDF using this link :

I had a "Unauthorized" error so I nanoed a config file.

Copy link

Fresher14 commented Jan 13, 2021

I ran this script in a corporate unix environment and it works great. Just rather slow.
Great job, thank you.

Copy link

santhalakshminarayana commented Oct 18, 2021

I had converted the above ImageMagick commands to OpenCV Python with some adjustments for white-board image enhancement.
If any one interested for Python implementation, find the script in white_board_enhance github repo.

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