netpbm-0.1.0: Loading PBM, PGM, PPM image files

Safe HaskellNone

Graphics.Netpbm

Description

Parsing the netpbm image formates (PBM, PGM and PPM, both ASCII and binary) from ByteStrings.

To parse one of these formats, use parsePPM.

Currently, only P6 images are implemented. Implementing the other types should be straighforward.

Synopsis

Documentation

data PPMType Source

The netpbm image type of an image.

Constructors

P1

ASCII bitmap

P2

ASCII greymap

P3

ASCII pixmap (color)

P4

binary bitmap

P5

binary greymap

P6

binary pixmap (color)

data PPM Source

A PPM file with type, dimensions, and image data.

Constructors

PPM 

Fields

ppmType :: PPMType
 
ppmWidth :: !Int
 
ppmHeight :: !Int
 
ppmData :: PpmPixelData
 

Instances

data PpmPixelRGB8 Source

A pixel containing three 8-bit color components, RGB.

data PpmPixelRGB16 Source

A pixel containing three 16-bit color components, RGB.

parsePPM :: ByteString -> PpmParseResultSource

Parses a PPM file from the given ByteString. On failure, Left error contains the error message. On success, Right (images, Maybe rest) contains the parsed images and potentially an unparsable rest input.

type PpmParseResult = Either String ([PPM], Maybe ByteString)Source

The result of a PPM parse.

See parsePPM.