pnm-0.1.0.0: PNM image format header parsing and pretty printing

Portabilityportable
Stabilityprovisional
Maintainerclaude@mathr.co.uk
Safe HaskellSafe-Infered

Codec.PNM

Description

PNM image format header parsing and pretty printing.

PNM is PBM + PGM + PPM, a family of lowest common denominator image file formats.

References: http://netpbm.sourceforge.net/doc/pnm.html.

Synopsis

Documentation

data PNM Source

PNM image headers.

Instances

pnmRasterBytes :: PNM -> Maybe IntegerSource

Compute the raster size in bytes for binary PNM images.

pnmPretty :: PNM -> ByteStringSource

Pretty-print a PNM image header without any comments.

data Parse p Source

The result of parsing.

Instances

Eq p => Eq (Parse p) 
Ord p => Ord (Parse p) 
Show p => Show (Parse p) 

pnmParse :: ByteString -> Parse PNMSource

Parse a PNM image header.

pnms :: ByteString -> [(PNM, ByteString)]Source

Parse a sequence of binary PNM images.

Malformed input (including huge raster sizes or plain images) is treated as end-of-image-stream.

unpnms :: [(PNM, ByteString)] -> ByteStringSource

Pretty-print a sequence of binary PNM images.

The precondition that the raster is of the correct length is not checked, so malformed output is possible.

onPNMs :: (PNM -> ByteString -> (PNM, ByteString)) -> ByteString -> ByteStringSource

Process a sequence of binary PNM images.

Malformed input (including huge raster sizes or plain images) is treated as end-of-image-stream.

The precondition that the raster is of the correct length is not checked, so malformed output is possible.

Header comments are not preserved.

onPNMs' :: (PNM -> ByteString -> ByteString) -> ByteString -> ByteStringSource

Process a sequence of binary PNM images.

Malformed input (including huge raster sizes or plain images) is treated as end-of-image-stream.

The precondition that the raster is of the correct length is not checked, so malformed output is possible.

Header comments are preserved. Assuming well-formed input:

 onPNMs' (\_ r -> r) = id