Skip to content
Forked unpaper repository
C Shell Emacs Lisp
Find file
Latest commit abf0b13 Jan 3, 2016 @Flameeyes tests: update golden files to reflect the actual output filetype.
Recompressing the source png files caused the output test files to be
emitted in a different format, so fix that.

Proper grayscale tests and golden files should actually be added, but
Failed to load latest commit information.
doc Add missing file. Aug 18, 2014
tests tests: update golden files to reflect the actual output filetype. Jan 3, 2016
.dir-locals.el Update README with build information. Add auto-fill-mode to MarkDown. Aug 17, 2014
.gitignore add compare-image binary Nov 29, 2014
.mailmap git: add a mailmap to make Jens's commits look nicer. Oct 8, 2011
AUTHORS Replaced interpolation functions for better image quality. Mar 8, 2013
COPYING Rename files to follow autotools style more closely. Aug 15, 2011 Remove explicit rule for tests/.dirstamp. Nov 11, 2014
NEWS Update version information and NEWS file for the next release. Nov 11, 2014 Update documentation about file formats. Aug 17, 2014 Update version information and NEWS file for the next release. Nov 11, 2014
file.c Destroy (most) of the libav data structures created during file loadi… Dec 1, 2014
imageprocess.c Consistently reduce to single precision floating point the rotation c… Nov 11, 2014
imageprocess.h Use float rather than double for rotation detection. Nov 11, 2014
parse.c Move mask checking into imageprocess.c as inline. Aug 16, 2014
parse.h Move mask checking into imageprocess.c as inline. Aug 16, 2014
tools.c Remove unused function. Aug 17, 2014
tools.h Remove unused function. Aug 17, 2014
unpaper.1.xml Move the local variables settings for nxml to .dir-locals. Aug 10, 2014
unpaper.c fix a possible printf(NULL) when -debug is used Dec 2, 2014
unpaper.h Use float for the degrees-to-radians conversion, too. Nov 11, 2014


Originally written by Jens Gulden — see AUTHORS for more information. Licensed under GNU GPL v2 — see COPYING for more information.


unpaper is a post-processing tool for scanned sheets of paper, especially for book pages that have been scanned from previously created photocopies. The main purpose is to make scanned book pages better readable on screen after conversion to PDF. Additionally, unpaper might be useful to enhance the quality of scanned pages before performing optical character recognition (OCR).

unpaper tries to clean scanned images by removing dark edges that appeared through scanning or copying on areas outside the actual page content (e.g. dark areas between the left-hand-side and the right-hand-side of a double- sided book-page scan).

The program also tries to detect misaligned centering and rotation of pages and will automatically straighten each page by rotating it to the correct angle. This process is called "deskewing".

Note that the automatic processing will sometimes fail. It is always a good idea to manually control the results of unpaper and adjust the parameter settings according to the requirements of the input. Each processing step can also be disabled individually for each sheet.

See further documentation for the supported file formats notes.


The only hard dependency of unpaper is libav, which is used for file input and output.

At the time of writing, any version of libav can be used, and at least from version 9 it supports a superset of the file formats supported by unpaper before version 6.

The yet to be released version 11 is recommended, once available, as it has better support for TIFF files, including a faster, less memory-consuming support for grayscale TIFF files, and support for grayscale and alpha files.

Building instructions

unpaper uses GNU Autotools for its build system, so you should be able to execute the same commands used for other software packages:

sudo make install

There are, though, some recommendations about the way you build the code. Since the tasks are calculation-intensive, it is important to build with optimizations turned on:

./configure CFLAGS="-O2 -march-native -pipe"

Even better, if your compiler supports it, is to use Link-Time Optimizations, as that has shown that execution time can improve sensibly:

./configure CFLAGS="-O2 -march=native -pipe -flto"

Further optimizations such as -ftracer and -ftree-vectorize are thought to work, but their effect has not been evaluated so your mileage may vary.

Further Information

You can find more information on the basic concepts and the image processing in the available documentation.

Something went wrong with that request. Please try again.