[Haskell-cafe] ANNOUNCE: netpbm

Niklas Hambüchen mail at nh2.me
Sat Mar 2 01:54:45 CET 2013


I'm happy to announce a new library, "netpbm", a full implementation of
the netpbm image formats (PPM, PGM, PBM) in pure Haskell.

The P*N formats describe themselves as "as easy as possible"; they
mainly consist of dimensions + uncompressed data and are used especially
in between graphics programs, e.g. between ImageMagick and its
ghostscript part as well as in ffmpeg.

There are six formats (bitmap, greyscale, color, each of them coming in
binary and ASCII variants). This parses all of them.

The main focus of this library is *pedantic* adherence to the spec
(http://netpbm.sourceforge.net/doc/pbm.html) - in fact I claim that all
implementations out there do not properly implement the spec correctly,
not even the netpbm project itself. I have not properly verified this
yet, but my library can parse valid PPM files that don't display in my
image viewer (which is built on top of the C library in question).
To be honest, one cannot really blame anybody for this since netpbm
allows pretty insane things (such as comments inside numeric literals)
and its claim to be simple is absolutely hilarious.

haskell-netpbm is backed by an extensive test suite that checks its
compatibility with images created by common programs (GIMP, convert),
public data sets, and random pictures I found on the Internet.

It is built using attoparsec. You can find it on

    http://hackage.haskell.org/package/netpbm

Any contributions in form of code, tests images or claims that I don't
implement the spec right are highly welcome at

    https://github.com/nh2/haskell-netpbm

Please note that I just finished the implementation and that I will
clean up (break) the API in the next release, but I found it made sense
to announce it as early as possible now that the format implementation
is complete.

Niklas



More information about the Haskell-Cafe mailing list