An efficient tool for creating thumbnails of PNG files.
C C++ Objective-C
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.



        pngscale <input file> <output file> <width px> <height px>

<input file> must refer to a valid PNG image. Output will be in
PNG format regardless of what name is specified.

<width px> and <height px> give the width and height of the output
file in pixels. If either <width px> or <height px> is set to -1, the
other is automatically set in such a way as to preserve the aspect
ratio of the original image as closely as possible.


To build pngscale, the libpng library is required. On Debian and
Ubuntu this can be installed with:

sudo apt-get install libpng-dev

Afterwards, run "make" to build. The pngscale binary will appear
in the current directory. Tests can be run with "test/test".


pngscale is a specialized tool for scaling of PNG files, intended
primarily for creating thumbnail images. It works scanline by
scanline, so it's memory-efficient even on extremely large PNG images,
taking only about 11 MB of RAM in experiments. It is also faster than
ImageMagick convert, particularly on large images, running about twice
as fast on a 50 megapixel file.

It produces 32-bpp RGBA thumbnails of RGBA images and palettized
images with transparency, 24-bpp RGB thumbnails of RGB images and
palettized images without transparency, and 8-bpp grayscale thumbnails
of grayscale images. Output has 8 bits per channel regardless of bits
per channel of the input. It has not been tested with progressive or
interlaced images, and upscales images using bilinear interpolation.

Error messages are currently English-only.


pngscale is produced by Derrick Coetzee and released under the MIT/X11
license, which permits any use commercial or noncommercial as long as
the license statement is retained. It is based on a sample by
Guillaume Cottenceau and contributors released under the MIT/X11
license at

Latest version of pngscale available from: