| Safe Haskell | None |
|---|
Graphics.Netpbm
Description
Parsing the netpbm image formates (PBM, PGM and PPM, both ASCII and binary) from ByteStrings.
All netpbm image formats are implemented (P1 - P6).
To parse one of these formats, use parsePPM.
- data PPMType
- data PPM = PPM {}
- data PpmPixelRGB8 = PpmPixelRGB8 !Word8 !Word8 !Word8
- data PpmPixelRGB16 = PpmPixelRGB16 !Word16 !Word16 !Word16
- newtype PbmPixel = PbmPixel Bool
- data PgmPixel8 = PgmPixel8 !Word8
- data PgmPixel16 = PgmPixel16 !Word16
- data PPMHeader = PPMHeader {}
- data PpmPixelData
- pixelVectorToList :: Unbox a => Vector a -> [a]
- pixelDataToIntList :: PpmPixelData -> [Int]
- 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.
Constructors
| PPM | |
Fields | |
data PpmPixelRGB8 Source
A pixel containing three 8-bit color components, RGB.
Constructors
| PpmPixelRGB8 !Word8 !Word8 !Word8 |
data PpmPixelRGB16 Source
A pixel containing three 16-bit color components, RGB.
Constructors
| PpmPixelRGB16 !Word16 !Word16 !Word16 |
A pixel containing black or white.
A pixel containing an 8-bit greyscale value.
data PpmPixelData Source
Image data, either 8 or 16 bits. TODO rename to PNM
Constructors
| PpmPixelDataRGB8 (Vector PpmPixelRGB8) | For 8-bit PPMs. |
| PpmPixelDataRGB16 (Vector PpmPixelRGB16) | For 16-bit PPMs. |
| PbmPixelData (Vector PbmPixel) | For 1-bit PBMs. |
| PgmPixelData8 (Vector PgmPixel8) | For 8-bit PGMs. |
| PgmPixelData16 (Vector PgmPixel16) | For 16-bit PGMs. |
pixelVectorToList :: Unbox a => Vector a -> [a]Source
pixelDataToIntList :: PpmPixelData -> [Int]Source
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.