Safe Haskell | None |
---|---|
Language | Haskell2010 |
Module implementing a basic png export, no filtering is applyed, but export at least valid images.
Synopsis
- class PngSavable a where
- encodePng :: Image a -> ByteString
- encodePngWithMetadata :: Metadatas -> Image a -> ByteString
- class PngPaletteSaveable a where
- encodePalettedPng :: Image a -> Image Pixel8 -> Either String ByteString
- encodePalettedPngWithMetadata :: Metadatas -> Image a -> Image Pixel8 -> Either String ByteString
- writePng :: PngSavable pixel => FilePath -> Image pixel -> IO ()
- encodeDynamicPng :: DynamicImage -> Either String ByteString
- writeDynamicPng :: FilePath -> DynamicImage -> IO (Either String Bool)
Documentation
class PngSavable a where Source #
Encode an image into a png if possible.
encodePng :: Image a -> ByteString Source #
Transform an image into a png encoded bytestring, ready to be written as a file.
encodePngWithMetadata :: Metadatas -> Image a -> ByteString Source #
Encode a png using some metadatas. The following metadata keys will
be stored in a tEXt
field :
Title
Description
Author
Copyright
Software
Comment
Disclaimer
Source
Warning
Unknown
using the key present in the constructor.
the followings metadata will bes tored in the gAMA
chunk.
The followings metadata will be stored in a pHYs
chunk
Instances
class PngPaletteSaveable a where Source #
Encode a paletted image into a png if possible.
encodePalettedPng :: Image a -> Image Pixel8 -> Either String ByteString Source #
Encode a paletted image as a color indexed 8-bit PNG.
the palette must have between 1 and 256 values in it.
Accepts PixelRGB8
and PixelRGBA8
as palette pixel type
encodePalettedPngWithMetadata :: Metadatas -> Image a -> Image Pixel8 -> Either String ByteString Source #
Equivalent to encodePalettedPng
but allow writing of metadatas.
See encodePngWithMetadata
for the details of encoded metadatas
Accepts PixelRGB8
and PixelRGBA8
as palette pixel type
Instances
PngPaletteSaveable PixelRGBA8 Source # | |
Defined in Codec.Picture.Png.Internal.Export | |
PngPaletteSaveable PixelRGB8 Source # | |
Defined in Codec.Picture.Png.Internal.Export |
writePng :: PngSavable pixel => FilePath -> Image pixel -> IO () Source #
Helper function to directly write an image as a png on disk.
encodeDynamicPng :: DynamicImage -> Either String ByteString Source #
Encode a dynamic image in PNG if possible, supported images are:
writeDynamicPng :: FilePath -> DynamicImage -> IO (Either String Bool) Source #
Write a dynamic image in a .png image file if possible. The same restriction as encodeDynamicPng apply.