Re: [dwm] Need a small image resize program

From: Thomas Lavergne <>
Date: Fri, 13 Jun 2008 14:41:23 +0200


Some times ago I've encoutered the same problem. In my case I've needed
a program to build thumbnails in a small cgi script and found no small
solutions. Installing imagemagick and all his dependancy on the web
server was against my religion ;-) so I've build a small resizer.

Before I say anything other be warned that this program was quickly
written, and the used only for a few weeks. So this is far from optimal
and may have a lot of bugs. I've never reused this code so I've never
improved it. It stay in my directory of project "that I must finish a
day a publish...."

This program only resize jpeg file but it was written with hability to
load a save other file formats so adding png will be easy, just add
loadin and saving of png, and select the good loader/saver depending on
file extention.

In order to produce an output of size (w,h), resizing is done in two
steps :
- First an the source picture is resample in a picture of size (5*w,5*h)
  using nearest neighboor.
- Second the final image is computed from this using a convolution
  matrix of size 5x5.

This allow good quality result with easy coding, but it require a lot of
memory and time if destination picture is huge. But keep in mind that it
was originaly written to produce thumbnails....

It only require the jpeglib. To compile it you can use something like :
        cc -W -Wall -ansi -pedantic -O3 -ljpeg -o apr apr.c

So use it at your own risk...


On Fri, Jun 13, 2008 at 10:43:46AM +0200, markus schnalke wrote:
> Hoi community,
> I feel the need for a image resize program that matches the
> Unix and suckless philosophy.
> Currently I'm using ImageMagick, which is just fine, if it is already
> installed. But I was shocked, when I had to install it on a clean
> system: I has that many dependencies!
> The only thing I wanted was a program to resize images and I had to
> install about 80 megabyte!
> Does anyone know a small program that can resize JPEG and PNG images?
> meillo

Thomas Lavergne                    "Entia non sunt multiplicanda praeter
                                     necessitatem." (Guillaume d'Ockham)                  

Received on Fri Jun 13 2008 - 15:00:28 UTC

This archive was generated by hypermail 2.2.0 : Sun Jul 13 2008 - 15:49:01 UTC