Safe Haskell | None |
---|
Parsing the netpbm image formates (PBM, PGM and PPM, both ASCII and binary) from ByteString
s.
To parse one of these formats, use parsePPM
.
Currently, only P6 images are implemented. Implementing the other types should be straighforward.
- data PPMType
- data PPM = PPM {}
- data PpmPixelRGB8
- data PpmPixelRGB16
- data PpmPixelData
- parsePPM :: ByteString -> PpmParseResult
- type PpmParseResult = Either String ([PPM], Maybe ByteString)
Documentation
The netpbm image type of an image.
A PPM file with type, dimensions, and image data.
data PpmPixelRGB8 Source
A pixel containing three 8-bit color components, RGB.
data PpmPixelRGB16 Source
A pixel containing three 16-bit color components, RGB.
data PpmPixelData Source
Image data, either 8 or 16 bits.
PpmPixelDataRGB8 (Vector PpmPixelRGB8) | For 8-bit PPMs. |
PpmPixelDataRGB16 (Vector PpmPixelRGB16) | For 16-bit PPMs. |
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
.