netpbm-1.0.4: Loading PBM, PGM, PPM image files
Safe HaskellNone
LanguageHaskell2010

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.

See also: http://www.imagemagick.org/Usage/formats/#netpbm

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)

Instances

Instances details
Enum PPMType Source # 
Instance details

Defined in Graphics.Netpbm

Eq PPMType Source # 
Instance details

Defined in Graphics.Netpbm

Methods

(==) :: PPMType -> PPMType -> Bool #

(/=) :: PPMType -> PPMType -> Bool #

Ord PPMType Source # 
Instance details

Defined in Graphics.Netpbm

Show PPMType Source # 
Instance details

Defined in Graphics.Netpbm

data PPM Source #

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

Constructors

PPM 

Instances

Instances details
Show PPM Source # 
Instance details

Defined in Graphics.Netpbm

Methods

showsPrec :: Int -> PPM -> ShowS #

show :: PPM -> String #

showList :: [PPM] -> ShowS #

data PpmPixelRGB8 Source #

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

Constructors

PpmPixelRGB8 !Word8 !Word8 !Word8 

Instances

Instances details
Eq PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

Show PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

Storable PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

Unbox PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

Vector Vector PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

MVector MVector PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

newtype Vector PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

newtype MVector s PpmPixelRGB8 Source # 
Instance details

Defined in Graphics.Netpbm

data PpmPixelRGB16 Source #

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

Instances

Instances details
Eq PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

Show PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

Storable PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

Unbox PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

Vector Vector PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

MVector MVector PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

newtype Vector PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

newtype MVector s PpmPixelRGB16 Source # 
Instance details

Defined in Graphics.Netpbm

newtype PbmPixel Source #

A pixel containing black or white.

Constructors

PbmPixel Bool 

Instances

Instances details
Eq PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

Show PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

Storable PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

Unbox PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

Vector Vector PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

MVector MVector PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

newtype Vector PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

newtype MVector s PbmPixel Source # 
Instance details

Defined in Graphics.Netpbm

data PgmPixel8 Source #

A pixel containing an 8-bit greyscale value.

Constructors

PgmPixel8 !Word8 

Instances

Instances details
Eq PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

Show PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

Storable PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

Unbox PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

Vector Vector PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

MVector MVector PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

newtype Vector PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

newtype MVector s PgmPixel8 Source # 
Instance details

Defined in Graphics.Netpbm

data PgmPixel16 Source #

A pixel containing a 16-bit greyscale value.

Constructors

PgmPixel16 !Word16 

Instances

Instances details
Eq PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

Show PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

Storable PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

Unbox PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

Vector Vector PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

MVector MVector PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

newtype Vector PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

newtype MVector s PgmPixel16 Source # 
Instance details

Defined in Graphics.Netpbm

data PPMHeader Source #

Meta information about the image: The exact PPM format and dimensions.

Constructors

PPMHeader 

Fields

Instances

Instances details
Eq PPMHeader Source # 
Instance details

Defined in Graphics.Netpbm

Show PPMHeader Source # 
Instance details

Defined in Graphics.Netpbm

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 :: Storable a => Vector a -> [a] Source #

Converts a vector of pixels to a list for convenience.

pixelDataToIntList :: PpmPixelData -> [Int] Source #

Converts pixel data to a list of positive Ints.

How big they can become depends on the bit depth of the pixel data.

parsePPM :: ByteString -> PpmParseResult Source #

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.