
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

That sounds cool!!!! Way to go Niklas!!!
Regards,
Kashyap
On Sat, Mar 2, 2013 at 6:24 AM, Niklas Hambüchen
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
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (2)
-
C K Kashyap
-
Niklas Hambüchen