streaming-png-0.1.0.0: Perfectly streaming PNG image decoding

Copyright(c) Bradley Hardy 2016
LicenseLGPL3
Maintainerbradleyhardy@live.com
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Codec.Picture.Png.Streaming

Contents

Description

A perfectly streaming PNG decoding library.

Synopsis

Decoding

decodePNG :: (MonadThrow m, MonadIO m) => ByteString m r -> m (DecodedPNG m (ByteString m r)) Source

Decode a PNG from the given raw streaming ByteString. The result is header information followed by a stream of bytes that can be interpreted directly as pixels whose format depends on the image's colour type and bit depth.

Any remaining data after the end of the PNG image is returned untouched.

decodePNGComplete :: (MonadThrow m, MonadIO m) => ByteString m r -> m (DecodedPNG m r) Source

Decode a PNG from the given raw streaming ByteString. The result is header information followed by a stream of bytes that can be interpreted directly as pixels whose format depends on the image's colour type and bit depth.

If there is any more data after the end of the PNG image, an ExpectedEOF exception is thrown.

decodePNGFile :: MonadResource m => FilePath -> m (DecodedPNG m ()) Source

Decode a PNG from the given file. The result is header information followed by a stream of bytes that can be interpreted directly as pixels whose format depends on the image's colour type and bit depth.

If there is any more data after the end of the PNG image, an ExpectedEOF exception is thrown.

decodeHeader :: MonadThrow m => ByteString m r -> m (Of HeaderData (ByteString m r)) Source

Decode just the PNG header data from the given raw streaming ByteString, inspecting the minimum number of bytes from the input necessary to do so. The remaining bytes are returned also.

Types

type DecodedPNG m r = Of HeaderData (ByteString m r) Source

A decoded PNG: header information followed by decoded pixel data whose format depends on the image's colour type and bit depth.

data HeaderData Source

Represents the header data of a PNG file in raw binary format.

Misc

type ChunkType = ByteString Source

A chunk type, represented as a ByteString of length 4.

type BitDepth = Word8 Source

A bit depth.

type ColourType = Word8 Source

A colour type.

type CompressionMethod = Word8 Source

A PNG compression method (distinct from the type in Zlib of the same name).

type FilterMethod = Word8 Source

A PNG filtering method.

type FilterType = Word8 Source

A PNG filter type, for filter method 0.

type InterlaceMethod = Word8 Source

A PNG interlacing method.

isColourTypeSupported :: ColourType -> Bool Source

Is the given PNG image colour type supported? Currently we only support non-indexed colour types.

isCompressionMethodSupported :: CompressionMethod -> Bool Source

Is the given PNG compression method supported? Currently we only support method 0.

isFilterMethodSupported :: FilterMethod -> Bool Source

Is the given PNG filter method supported? Currently we only support method 0.

isInterlaceMethodSupported :: InterlaceMethod -> Bool Source

Is the given PNG interlace method supported? Currently only the null interlace method (no interlacing) is supported.