massiv-io 0.4.1.0 → 1.0.0.0
raw patch · 18 files changed
+138/−170 lines, 18 filesdep ~massivPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: massiv
API changes (from Hackage documentation)
- Data.Massiv.Array.IO: demoteLumaAlphaImage :: Array S Ix2 (Pixel (Alpha (Y' cs)) e) -> Array S Ix2 (Pixel (Alpha X) e)
- Data.Massiv.Array.IO: demoteLumaImage :: Array S Ix2 (Pixel (Y' cs) e) -> Array S Ix2 (Pixel X e)
- Data.Massiv.Array.IO: promoteLumaAlphaImage :: Array S Ix2 (Pixel (Alpha X) e) -> Array S Ix2 (Pixel (Alpha (Y' cs)) e)
- Data.Massiv.Array.IO: promoteLumaImage :: Array S Ix2 (Pixel X e) -> Array S Ix2 (Pixel (Y' cs) e)
- Data.Massiv.Array.IO: coerceBinaryImage :: Array S Ix2 (Pixel X Bit) -> Array S Ix2 (Pixel X Word8)
+ Data.Massiv.Array.IO: coerceBinaryImage :: Matrix S (Pixel X Bit) -> Matrix S (Pixel X Word8)
- Data.Massiv.Array.IO: convertImage :: (Source r' Ix2 (Pixel cs' e'), ColorSpace cs' i' e', ColorSpace cs i e) => Image r' cs' e' -> Image D cs e
+ Data.Massiv.Array.IO: convertImage :: (Source r' (Pixel cs' e'), ColorSpace cs' i' e', ColorSpace cs i e) => Image r' cs' e' -> Image D cs e
- Data.Massiv.Array.IO: decodeAutoBMP :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto BMP -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoBMP :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto BMP -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoGIF :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto GIF -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoGIF :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto GIF -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoHDR :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto HDR -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoHDR :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto HDR -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoJPG :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto JPG -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoJPG :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto JPG -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoNetpbmImage :: (FileFormat f, Mutable r Ix2 (Pixel cs e), MonadThrow m, ColorSpace cs i e) => f -> ByteString -> m (Image r cs e, Maybe ByteString)
+ Data.Massiv.Array.IO: decodeAutoNetpbmImage :: (FileFormat f, Manifest r (Pixel cs e), MonadThrow m, ColorSpace cs i e) => f -> ByteString -> m (Image r cs e, Maybe ByteString)
- Data.Massiv.Array.IO: decodeAutoNetpbmImageSequence :: (FileFormat (Sequence f), Mutable r Ix2 (Pixel cs e), MonadThrow m, ColorSpace cs i e) => Auto (Sequence f) -> ByteString -> m ([Image r cs e], Maybe ByteString)
+ Data.Massiv.Array.IO: decodeAutoNetpbmImageSequence :: (FileFormat (Sequence f), Manifest r (Pixel cs e), MonadThrow m, ColorSpace cs i e) => Auto (Sequence f) -> ByteString -> m ([Image r cs e], Maybe ByteString)
- Data.Massiv.Array.IO: decodeAutoPNG :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto PNG -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoPNG :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto PNG -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoSequenceGIF :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto (Sequence GIF) -> ByteString -> m [Image r cs e]
+ Data.Massiv.Array.IO: decodeAutoSequenceGIF :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto (Sequence GIF) -> ByteString -> m [Image r cs e]
- Data.Massiv.Array.IO: decodeAutoSequenceWithMetadataGIF :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto (Sequence GIF) -> ByteString -> m ([Image r cs e], [GifDelay])
+ Data.Massiv.Array.IO: decodeAutoSequenceWithMetadataGIF :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto (Sequence GIF) -> ByteString -> m ([Image r cs e], [GifDelay])
- Data.Massiv.Array.IO: decodeAutoTGA :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TGA -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoTGA :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TGA -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoTIF :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TIF -> ByteString -> m (Image r cs e)
+ Data.Massiv.Array.IO: decodeAutoTIF :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TIF -> ByteString -> m (Image r cs e)
- Data.Massiv.Array.IO: decodeAutoWithMetadataBMP :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto BMP -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataBMP :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto BMP -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: decodeAutoWithMetadataGIF :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto GIF -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataGIF :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto GIF -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: decodeAutoWithMetadataHDR :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto HDR -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataHDR :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto HDR -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: decodeAutoWithMetadataJPG :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto JPG -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataJPG :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto JPG -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: decodeAutoWithMetadataPNG :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto PNG -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataPNG :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto PNG -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: decodeAutoWithMetadataTGA :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TGA -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataTGA :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TGA -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: decodeAutoWithMetadataTIF :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TIF -> ByteString -> m (Image r cs e, Metadatas)
+ Data.Massiv.Array.IO: decodeAutoWithMetadataTIF :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TIF -> ByteString -> m (Image r cs e, Metadatas)
- Data.Massiv.Array.IO: encodeAutoBMP :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e)) => Auto BMP -> BitmapOptions -> Image r cs e -> ByteString
+ Data.Massiv.Array.IO: encodeAutoBMP :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto BMP -> BitmapOptions -> Image r cs e -> ByteString
- Data.Massiv.Array.IO: encodeAutoGIF :: forall r cs i e m. (ColorSpace cs i e, Source r Ix2 (Pixel cs e), MonadThrow m) => Auto GIF -> GifOptions -> Image r cs e -> m ByteString
+ Data.Massiv.Array.IO: encodeAutoGIF :: forall r cs i e m. (ColorSpace cs i e, Source r (Pixel cs e), MonadThrow m) => Auto GIF -> GifOptions -> Image r cs e -> m ByteString
- Data.Massiv.Array.IO: encodeAutoHDR :: forall r cs i e. (ColorSpace cs i e, Source r Ix2 (Pixel cs e)) => Auto HDR -> HdrOptions -> Image r cs e -> ByteString
+ Data.Massiv.Array.IO: encodeAutoHDR :: forall r cs i e. (ColorSpace cs i e, Source r (Pixel cs e)) => Auto HDR -> HdrOptions -> Image r cs e -> ByteString
- Data.Massiv.Array.IO: encodeAutoJPG :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e)) => Auto JPG -> JpegOptions -> Image r cs e -> ByteString
+ Data.Massiv.Array.IO: encodeAutoJPG :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto JPG -> JpegOptions -> Image r cs e -> ByteString
- Data.Massiv.Array.IO: encodeAutoPNG :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e)) => Auto PNG -> Image r cs e -> ByteString
+ Data.Massiv.Array.IO: encodeAutoPNG :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto PNG -> Image r cs e -> ByteString
- Data.Massiv.Array.IO: encodeAutoTGA :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e)) => Auto TGA -> Image r cs e -> ByteString
+ Data.Massiv.Array.IO: encodeAutoTGA :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto TGA -> Image r cs e -> ByteString
- Data.Massiv.Array.IO: encodeAutoTIF :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e)) => Auto TIF -> Image r cs e -> ByteString
+ Data.Massiv.Array.IO: encodeAutoTIF :: forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto TIF -> Image r cs e -> ByteString
- Data.Massiv.Array.IO: fromDynamicImageAuto :: forall r cs i e m. (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m) => DynamicImage -> m (Image r cs e)
+ Data.Massiv.Array.IO: fromDynamicImageAuto :: forall r cs i e m. (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => DynamicImage -> m (Image r cs e)
- Data.Massiv.Array.IO: fromImageBaseModel :: Array S Ix2 (Pixel (BaseModel cs) e) -> Array S Ix2 (Pixel cs e)
+ Data.Massiv.Array.IO: fromImageBaseModel :: Matrix S (Pixel (BaseModel cs) e) -> Matrix S (Pixel cs e)
- Data.Massiv.Array.IO: imageReadAutoFormats :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) => [Decode (Image r cs e)]
+ Data.Massiv.Array.IO: imageReadAutoFormats :: (Manifest r (Pixel cs e), ColorSpace cs i e) => [Decode (Image r cs e)]
- Data.Massiv.Array.IO: imageWriteAutoFormats :: (Source r Ix2 (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) => [Encode (Image r cs e)]
+ Data.Massiv.Array.IO: imageWriteAutoFormats :: (Source r (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) => [Encode (Image r cs e)]
- Data.Massiv.Array.IO: imageWriteFormats :: (Source r Ix2 (Pixel cs e), ColorModel cs e) => [Encode (Image r cs e)]
+ Data.Massiv.Array.IO: imageWriteFormats :: (Source r (Pixel cs e), ColorModel cs e) => [Encode (Image r cs e)]
- Data.Massiv.Array.IO: readImageAuto :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadIO m) => FilePath -> m (Image r cs e)
+ Data.Massiv.Array.IO: readImageAuto :: (Manifest r (Pixel cs e), ColorSpace cs i e, MonadIO m) => FilePath -> m (Image r cs e)
- Data.Massiv.Array.IO: toImageBaseModel :: Array S Ix2 (Pixel cs e) -> Array S Ix2 (Pixel (BaseModel cs) e)
+ Data.Massiv.Array.IO: toImageBaseModel :: Matrix S (Pixel cs e) -> Matrix S (Pixel (BaseModel cs) e)
- Data.Massiv.Array.IO: toJPImageCMYK16 :: Source r Ix2 (Pixel CMYK Word16) => Image r CMYK Word16 -> Image PixelCMYK16
+ Data.Massiv.Array.IO: toJPImageCMYK16 :: Source r (Pixel CMYK Word16) => Image r CMYK Word16 -> Image PixelCMYK16
- Data.Massiv.Array.IO: toJPImageCMYK8 :: Source r Ix2 (Pixel CMYK Word8) => Image r CMYK Word8 -> Image PixelCMYK8
+ Data.Massiv.Array.IO: toJPImageCMYK8 :: Source r (Pixel CMYK Word8) => Image r CMYK Word8 -> Image PixelCMYK8
- Data.Massiv.Array.IO: toJPImageRGB16 :: Source r Ix2 (Pixel RGB Word16) => Image r RGB Word16 -> Image PixelRGB16
+ Data.Massiv.Array.IO: toJPImageRGB16 :: Source r (Pixel RGB Word16) => Image r RGB Word16 -> Image PixelRGB16
- Data.Massiv.Array.IO: toJPImageRGB8 :: Source r Ix2 (Pixel RGB Word8) => Image r RGB Word8 -> Image PixelRGB8
+ Data.Massiv.Array.IO: toJPImageRGB8 :: Source r (Pixel RGB Word8) => Image r RGB Word8 -> Image PixelRGB8
- Data.Massiv.Array.IO: toJPImageRGBA16 :: Source r Ix2 (Pixel (Alpha RGB) Word16) => Image r (Alpha RGB) Word16 -> Image PixelRGBA16
+ Data.Massiv.Array.IO: toJPImageRGBA16 :: Source r (Pixel (Alpha RGB) Word16) => Image r (Alpha RGB) Word16 -> Image PixelRGBA16
- Data.Massiv.Array.IO: toJPImageRGBA8 :: Source r Ix2 (Pixel (Alpha RGB) Word8) => Image r (Alpha RGB) Word8 -> Image PixelRGBA8
+ Data.Massiv.Array.IO: toJPImageRGBA8 :: Source r (Pixel (Alpha RGB) Word8) => Image r (Alpha RGB) Word8 -> Image PixelRGBA8
- Data.Massiv.Array.IO: toJPImageRGBF :: Source r Ix2 (Pixel RGB Float) => Image r RGB Float -> Image PixelRGBF
+ Data.Massiv.Array.IO: toJPImageRGBF :: Source r (Pixel RGB Float) => Image r RGB Float -> Image PixelRGBF
- Data.Massiv.Array.IO: toJPImageY16 :: Source r Ix2 (Pixel X Word16) => Image r X Word16 -> Image Pixel16
+ Data.Massiv.Array.IO: toJPImageY16 :: Source r (Pixel X Word16) => Image r X Word16 -> Image Pixel16
- Data.Massiv.Array.IO: toJPImageY32 :: Source r Ix2 (Pixel X Word32) => Image r X Word32 -> Image Pixel32
+ Data.Massiv.Array.IO: toJPImageY32 :: Source r (Pixel X Word32) => Image r X Word32 -> Image Pixel32
- Data.Massiv.Array.IO: toJPImageY8 :: Source r Ix2 (Pixel X Word8) => Image r X Word8 -> Image Pixel8
+ Data.Massiv.Array.IO: toJPImageY8 :: Source r (Pixel X Word8) => Image r X Word8 -> Image Pixel8
- Data.Massiv.Array.IO: toJPImageYA16 :: Source r Ix2 (Pixel (Alpha X) Word16) => Image r (Alpha X) Word16 -> Image PixelYA16
+ Data.Massiv.Array.IO: toJPImageYA16 :: Source r (Pixel (Alpha X) Word16) => Image r (Alpha X) Word16 -> Image PixelYA16
- Data.Massiv.Array.IO: toJPImageYA8 :: Source r Ix2 (Pixel (Alpha X) Word8) => Image r (Alpha X) Word8 -> Image PixelYA8
+ Data.Massiv.Array.IO: toJPImageYA8 :: Source r (Pixel (Alpha X) Word8) => Image r (Alpha X) Word8 -> Image PixelYA8
- Data.Massiv.Array.IO: toJPImageYCbCr8 :: Source r Ix2 (Pixel YCbCr Word8) => Image r YCbCr Word8 -> Image PixelYCbCr8
+ Data.Massiv.Array.IO: toJPImageYCbCr8 :: Source r (Pixel YCbCr Word8) => Image r YCbCr Word8 -> Image PixelYCbCr8
- Data.Massiv.Array.IO: toJPImageYF :: Source r Ix2 (Pixel X Float) => Image r X Float -> Image PixelF
+ Data.Massiv.Array.IO: toJPImageYF :: Source r (Pixel X Float) => Image r X Float -> Image PixelF
- Data.Massiv.Array.IO: type Image r cs e = Array r Ix2 (Pixel cs e)
+ Data.Massiv.Array.IO: type Image r cs e = Matrix r (Pixel cs e)
- Data.Massiv.Array.IO: writeImage :: (Source r Ix2 (Pixel cs e), ColorModel cs e, MonadIO m) => FilePath -> Image r cs e -> m ()
+ Data.Massiv.Array.IO: writeImage :: (Source r (Pixel cs e), ColorModel cs e, MonadIO m) => FilePath -> Image r cs e -> m ()
- Data.Massiv.Array.IO: writeImageAuto :: (Source r Ix2 (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, MonadIO m) => FilePath -> Image r cs e -> m ()
+ Data.Massiv.Array.IO: writeImageAuto :: (Source r (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, MonadIO m) => FilePath -> Image r cs e -> m ()
Files
- README.md +3/−3
- massiv-io.cabal +3/−2
- src/Data/Massiv/Array/IO.hs +6/−10
- src/Data/Massiv/Array/IO/Base.hs +7/−53
- src/Data/Massiv/Array/IO/Image.hs +3/−3
- src/Data/Massiv/Array/IO/Image/JuicyPixels/BMP.hs +7/−6
- src/Data/Massiv/Array/IO/Image/JuicyPixels/Base.hs +38/−35
- src/Data/Massiv/Array/IO/Image/JuicyPixels/GIF.hs +10/−10
- src/Data/Massiv/Array/IO/Image/JuicyPixels/HDR.hs +6/−6
- src/Data/Massiv/Array/IO/Image/JuicyPixels/JPG.hs +6/−6
- src/Data/Massiv/Array/IO/Image/JuicyPixels/PNG.hs +6/−6
- src/Data/Massiv/Array/IO/Image/JuicyPixels/TGA.hs +6/−6
- src/Data/Massiv/Array/IO/Image/JuicyPixels/TIF.hs +6/−6
- src/Data/Massiv/Array/IO/Image/Netpbm.hs +11/−11
- tests/Main.hs +3/−2
- tests/Spec.hs +1/−1
- tests/Test/Massiv/Array/IO/Image/Common.hs +5/−4
- tests/doctests.hs +11/−0
README.md view
@@ -5,9 +5,9 @@ ## Status -| Language | Travis | Azure | Coveralls |Gitter.im |-|:--------:|:------:|:-----:|:---------:|:--------:|-|  | [](https://travis-ci.org/lehins/massiv-io) | [](https://dev.azure.com/kuleshevich/massiv-io/_build?definitionId=1&branchName=master) | [](https://coveralls.io/github/lehins/massiv-io?branch=master) | [](https://gitter.im/haskell-massiv/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)+| Language | Github Actions | Azure | Coveralls |Gitter.im |+|:--------:|:--------------:|:-----:|:---------:|:--------:|+|  | [](https://github.com/lehins/massiv-io/actions) | [](https://dev.azure.com/kuleshevich/massiv-io/_build?definitionId=1&branchName=master) | [](https://coveralls.io/github/lehins/massiv-io?branch=master) | [](https://gitter.im/haskell-massiv/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) | Package | Hackage | Nightly | LTS | |:-------------------|:-------:|:-------:|:---:|
massiv-io.cabal view
@@ -1,5 +1,5 @@ name: massiv-io-version: 0.4.1.0+version: 1.0.0.0 synopsis: Import/export of Image files into massiv Arrays description: This package contains functionality for import/export of arrays into the real world. For now it only has the ability to read/write@@ -40,7 +40,7 @@ , deepseq , exceptions , filepath- , massiv >= 0.3+ , massiv >= 1.0.0 , JuicyPixels >= 3.3.5 , netpbm , unliftio >= 0.2.12@@ -64,6 +64,7 @@ , Test.Massiv.Array.IO.Image.JuicyPixelsSpec , Test.Massiv.Array.IO.Image.AutoSpec , Spec+ build-tool-depends: hspec-discover:hspec-discover build-depends: JuicyPixels , QuickCheck , base
src/Data/Massiv/Array/IO.hs view
@@ -59,12 +59,10 @@ convertImage, coerceBinaryImage, decode', decodeError, defaultWriteOptions,- demoteLumaAlphaImage, demoteLumaImage, encode', encodeError, fromImageBaseModel, fromMaybeDecode, fromMaybeEncode,- promoteLumaAlphaImage,- promoteLumaImage, toImageBaseModel,+ toImageBaseModel, toProxy) import Data.Massiv.Array.IO.Image import Graphics.Pixel.ColorSpace@@ -208,7 +206,7 @@ -- -- @since 0.1.0 readImageAuto ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadIO m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadIO m) => FilePath -- ^ File path for an image -> m (Image r cs e) readImageAuto path = liftIO (B.readFile path >>= decodeImageM imageReadAutoFormats path)@@ -228,7 +226,7 @@ -- -- @since 0.1.0 writeImage ::- (Source r Ix2 (Pixel cs e), ColorModel cs e, MonadIO m) => FilePath -> Image r cs e -> m ()+ (Source r (Pixel cs e), ColorModel cs e, MonadIO m) => FilePath -> Image r cs e -> m () writeImage path img = liftIO (encodeImageM imageWriteFormats path img >>= writeLazyAtomically path) @@ -245,7 +243,7 @@ -- -- @since 0.1.0 writeImageAuto ::- (Source r Ix2 (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, MonadIO m)+ (Source r (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, MonadIO m) => FilePath -> Image r cs e -> m ()@@ -253,7 +251,6 @@ liftIO (encodeImageM imageWriteAutoFormats path img >>= writeLazyAtomically path) - -- | An image is written as a @.tiff@ file into an operating system's temporary -- directory and passed as an argument to the external viewer program. --@@ -265,8 +262,7 @@ -- closed. Supplying `False` is only safe in the ghci session. -> Image r cs e -- ^ Image to display -> m ()-displayImageUsing viewer block =- displayImageUsingAdhoc viewer block (writableAdhoc (Auto TIF))+displayImageUsing viewer block = displayImageUsingAdhoc viewer block (writableAdhoc (Auto TIF)) -- | Encode an image using an adhoc into an operating system's temporary@@ -317,7 +313,7 @@ -- set as a default image viewer by the OS. This is a non-blocking function call, so it -- might take some time before an image will appear. ----- /Note/ - This function should only be used in ghci, otherwise use @`displayImage`+-- /Note/ - This function should only be used in ghci, otherwise use @`displayImageUsing` -- `defaultViewer` `True`@ -- -- @since 0.1.0
src/Data/Massiv/Array/IO/Base.hs view
@@ -1,4 +1,3 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE DefaultSignatures #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-}@@ -35,10 +34,6 @@ , toImageBaseModel , fromImageBaseModel , coerceBinaryImage- , demoteLumaImage- , promoteLumaImage- , demoteLumaAlphaImage- , promoteLumaAlphaImage , defaultWriteOptions , encodeError , decodeError@@ -65,11 +60,9 @@ import Prelude as P import System.FilePath (takeExtension) import Unsafe.Coerce-#if !MIN_VERSION_massiv(0,5,0)-import Data.Massiv.Array.Manifest.Vector-#endif-type Image r cs e = A.Array r A.Ix2 (Pixel cs e) +type Image r cs e = A.Matrix r (Pixel cs e)+ -- | Conversion error, which is thrown when there is a mismatch between the expected array -- type and the one supported by the file format. It is also thrown upon a failure of -- automatic conversion between those types, in case when such conversion is utilized.@@ -277,7 +270,7 @@ -- -- @since 0.2.0 convertImage ::- (A.Source r' A.Ix2 (Pixel cs' e'), ColorSpace cs' i' e', ColorSpace cs i e)+ (A.Source r' (Pixel cs' e'), ColorSpace cs' i' e', ColorSpace cs i e) => Image r' cs' e' -> Image A.D cs e convertImage = A.map convertPixel@@ -286,7 +279,7 @@ -- available `ColorSpace` instances this function is perfectly safe. -- -- @since 0.2.0-toImageBaseModel :: A.Array A.S A.Ix2 (Pixel cs e) -> A.Array A.S A.Ix2 (Pixel (BaseModel cs) e)+toImageBaseModel :: A.Matrix A.S (Pixel cs e) -> A.Matrix A.S (Pixel (BaseModel cs) e) toImageBaseModel = unsafeCoerce @@ -294,58 +287,19 @@ -- available `ColorSpace` instances this function is perfectly safe. -- -- @since 0.2.0-fromImageBaseModel :: A.Array A.S A.Ix2 (Pixel (BaseModel cs) e) -> A.Array A.S A.Ix2 (Pixel cs e)+fromImageBaseModel :: A.Matrix A.S (Pixel (BaseModel cs) e) -> A.Matrix A.S (Pixel cs e) fromImageBaseModel = unsafeCoerce -- | Convert Binary image to its Word8 backed pixel without copy -- -- @since 0.4.1-coerceBinaryImage :: A.Array A.S A.Ix2 (Pixel CM.X Bit) -> A.Array A.S A.Ix2 (Pixel CM.X Word8)+coerceBinaryImage :: A.Matrix A.S (Pixel CM.X Bit) -> A.Matrix A.S (Pixel CM.X Word8) coerceBinaryImage = unsafeCoerce --- | Cast an array with Luma pixels to an array with pixels in a plain single channel--- `CM.X` color model------ @since 0.2.1-demoteLumaImage :: A.Array A.S A.Ix2 (Pixel (Y' cs) e) -> A.Array A.S A.Ix2 (Pixel CM.X e)-demoteLumaImage = unsafeCoerce-{-# DEPRECATED demoteLumaImage "In favor of `toImageBaseModel`" #-}---- | Cast an array with pixels in a plain single channel `CM.X` color model to an array--- with Luma pixels------ @since 0.2.1-promoteLumaImage :: A.Array A.S A.Ix2 (Pixel CM.X e) -> A.Array A.S A.Ix2 (Pixel (Y' cs) e)-promoteLumaImage = unsafeCoerce-{-# DEPRECATED promoteLumaImage "In favor of `fromImageBaseModel`" #-}---- | Same as `demoteLumaImage`, but with Alpha channel------ @since 0.2.1-demoteLumaAlphaImage ::- A.Array A.S A.Ix2 (Pixel (Alpha (Y' cs)) e) -> A.Array A.S A.Ix2 (Pixel (Alpha CM.X) e)-demoteLumaAlphaImage = unsafeCoerce-{-# DEPRECATED demoteLumaAlphaImage "In favor of `toImageBaseModel`" #-}----- | Same as `promoteLumaImage` but with Alpha channel------ @since 0.2.1-promoteLumaAlphaImage ::- A.Array A.S A.Ix2 (Pixel (Alpha CM.X) e) -> A.Array A.S A.Ix2 (Pixel (Alpha (Y' cs)) e)-promoteLumaAlphaImage = unsafeCoerce-{-# DEPRECATED promoteLumaAlphaImage "In favor of `fromImageBaseModel`" #-}--- unsafeFromStorableVectorM :: (MonadThrow m, A.Index ix, A.Storable a, A.Storable b) => A.Sz ix -> V.Vector a -> m (A.Array A.S ix b) unsafeFromStorableVectorM sz v =-#if MIN_VERSION_massiv(0,5,0)- A.resizeM sz $ A.fromStorableVector A.Par $ V.unsafeCast v-#else- fromVectorM A.Par sz $ V.unsafeCast v-#endif+ A.resizeM sz $ A.fromStorableVector A.Par $ V.unsafeCast v
src/Data/Massiv/Array/IO/Image.hs view
@@ -92,7 +92,7 @@ -- | List of image formats that can be encoded without any color space conversion.-imageWriteFormats :: (Source r Ix2 (Pixel cs e), ColorModel cs e) => [Encode (Image r cs e)]+imageWriteFormats :: (Source r (Pixel cs e), ColorModel cs e) => [Encode (Image r cs e)] imageWriteFormats = [ Encode PNG (\ f -> encodePNG f . computeSource @S) , Encode TIF (\ f -> encodeTIF f . computeSource @S)@@ -105,7 +105,7 @@ -- | List of image formats that can be encoded with any necessary color space conversions. imageWriteAutoFormats ::- (Source r Ix2 (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e)+ (Source r (Pixel cs e), ColorSpace cs i e, ColorSpace (BaseSpace cs) i e) => [Encode (Image r cs e)] imageWriteAutoFormats = [ Encode (Auto PNG) (\f -> pure . encodeAutoPNG f)@@ -183,7 +183,7 @@ -- | List of image formats decodable with automatic colorspace conversion imageReadAutoFormats- :: (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e)+ :: (Manifest r (Pixel cs e), ColorSpace cs i e) => [Decode (Image r cs e)] imageReadAutoFormats = [ Decode (Auto PNG) decodeAutoPNG
src/Data/Massiv/Array/IO/Image/JuicyPixels/BMP.hs view
@@ -90,7 +90,7 @@ instance Writable BMP (Image S (Alpha (SRGB 'NonLinear)) Word8) where encodeM f opts = encodeM f opts . toImageBaseModel -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto BMP) (Image r cs e) where encodeM f opts = pure . encodeAutoBMP f opts @@ -127,7 +127,7 @@ -- | Decode a Bitmap Image decodeAutoBMP ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto BMP -> B.ByteString -> m (Image r cs e)@@ -135,13 +135,13 @@ -- | Decode a Bitmap Image decodeAutoWithMetadataBMP ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto BMP -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataBMP f bs = convertAutoWithMetadata f (JP.decodeBitmapWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto BMP) (Image r cs e) where decodeM = decodeAutoBMP decodeWithMetadataM = decodeAutoWithMetadataBMP@@ -169,7 +169,8 @@ encodeAutoBMP ::- forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e))+ forall r cs i e.+ (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto BMP -> BitmapOptions -> Image r cs e@@ -188,7 +189,7 @@ ] where toBitmap ::- (JP.BmpEncodable px, Source r ix a)+ (JP.BmpEncodable px, Source r a, Index ix) => (Array D ix b -> JP.Image px) -> (a -> b) -> Array r ix a
src/Data/Massiv/Array/IO/Image/JuicyPixels/Base.hs view
@@ -102,7 +102,7 @@ pure (i, meta) convertAutoWithMetadata ::- (MonadThrow m, Mutable r Ix2 (Pixel cs e), ColorSpace cs i e)+ (MonadThrow m, Manifest r (Pixel cs e), ColorSpace cs i e) => Auto f -> Either String (JP.DynamicImage, Metadata f) -> m (Image r cs e, Metadata f)@@ -114,7 +114,7 @@ pure (i, meta) convertAutoWith ::- (MonadThrow m, Mutable r Ix2 (Pixel cs e), ColorSpace cs i e)+ (MonadThrow m, Manifest r (Pixel cs e), ColorSpace cs i e) => Auto f -> Either String JP.DynamicImage -> m (Image r cs e)@@ -132,7 +132,7 @@ convertAutoSequenceWith ::- (MonadThrow m, Mutable r Ix2 (Pixel cs e), ColorSpace cs i e)+ (MonadThrow m, Manifest r (Pixel cs e), ColorSpace cs i e) => Auto (Sequence f) -> Either String [JP.DynamicImage] -> m [Image r cs e]@@ -283,7 +283,7 @@ {-# DEPRECATED fromDynamicImage "In favor of `fromDynamicImageM`" #-} fromDynamicImageAuto ::- forall r cs i e m. (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ forall r cs i e m. (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => JP.DynamicImage -> m (Image r cs e) fromDynamicImageAuto jpDynImg =@@ -343,9 +343,12 @@ -- Encoding -toJPImageUnsafe- :: forall r cs a . (JP.Pixel a, Source r Ix2 (Pixel cs (JP.PixelBaseComponent a)),- ColorModel cs (JP.PixelBaseComponent a))+toJPImageUnsafe ::+ forall r cs a.+ ( JP.Pixel a+ , Source r (Pixel cs (JP.PixelBaseComponent a))+ , ColorModel cs (JP.PixelBaseComponent a)+ ) => Image r cs (JP.PixelBaseComponent a) -> JP.Image a toJPImageUnsafe img = JP.Image n m $ V.unsafeCast $ toStorableVector arrS@@ -354,12 +357,12 @@ Sz (m :. n) = size img {-# INLINE toJPImageUnsafe #-} -toJPImageY8 :: Source r Ix2 (Pixel CM.X Word8) => Image r CM.X Word8 -> JP.Image JP.Pixel8+toJPImageY8 :: Source r (Pixel CM.X Word8) => Image r CM.X Word8 -> JP.Image JP.Pixel8 toJPImageY8 = toJPImageUnsafe {-# INLINE toJPImageY8 #-} maybeJPImageY8 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word8))+ forall cs. (Typeable cs, Storable (Pixel cs Word8)) => Image S cs Word8 -> Maybe (JP.Image JP.Pixel8) maybeJPImageY8 img =@@ -370,14 +373,14 @@ ] {-# INLINE maybeJPImageY8 #-} -toJPImageY16 :: Source r Ix2 (Pixel CM.X Word16) => Image r CM.X Word16 -> JP.Image JP.Pixel16+toJPImageY16 :: Source r (Pixel CM.X Word16) => Image r CM.X Word16 -> JP.Image JP.Pixel16 toJPImageY16 = toJPImageUnsafe {-# INLINE toJPImageY16 #-} maybeJPImageY16 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word16))+ forall cs. (Typeable cs, Storable (Pixel cs Word16)) => Image S cs Word16 -> Maybe (JP.Image JP.Pixel16) maybeJPImageY16 img =@@ -388,13 +391,13 @@ ] {-# INLINE maybeJPImageY16 #-} -toJPImageY32 :: Source r Ix2 (Pixel CM.X Word32) => Image r CM.X Word32 -> JP.Image JP.Pixel32+toJPImageY32 :: Source r (Pixel CM.X Word32) => Image r CM.X Word32 -> JP.Image JP.Pixel32 toJPImageY32 = toJPImageUnsafe {-# INLINE toJPImageY32 #-} maybeJPImageY32 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word32))+ forall cs. (Typeable cs, Storable (Pixel cs Word32)) => Image S cs Word32 -> Maybe (JP.Image JP.Pixel32) maybeJPImageY32 img =@@ -406,13 +409,13 @@ {-# INLINE maybeJPImageY32 #-} -toJPImageYF :: Source r Ix2 (Pixel CM.X Float) => Image r CM.X Float -> JP.Image JP.PixelF+toJPImageYF :: Source r (Pixel CM.X Float) => Image r CM.X Float -> JP.Image JP.PixelF toJPImageYF = toJPImageUnsafe {-# INLINE toJPImageYF #-} maybeJPImageYF ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Float))+ forall cs. (Typeable cs, Storable (Pixel cs Float)) => Image S cs Float -> Maybe (JP.Image JP.PixelF) maybeJPImageYF img =@@ -425,12 +428,12 @@ toJPImageYA8 ::- Source r Ix2 (Pixel (Alpha CM.X) Word8) => Image r (Alpha CM.X) Word8 -> JP.Image JP.PixelYA8+ Source r (Pixel (Alpha CM.X) Word8) => Image r (Alpha CM.X) Word8 -> JP.Image JP.PixelYA8 toJPImageYA8 = toJPImageUnsafe {-# INLINE toJPImageYA8 #-} maybeJPImageYA8 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel (Alpha cs) Word8))+ forall cs. (Typeable cs, Storable (Pixel (Alpha cs) Word8)) => Image S (Alpha cs) Word8 -> Maybe (JP.Image JP.PixelYA8) maybeJPImageYA8 img =@@ -443,7 +446,7 @@ toJPImageYA16 ::- Source r Ix2 (Pixel (Alpha CM.X) Word16)+ Source r (Pixel (Alpha CM.X) Word16) => Image r (Alpha CM.X) Word16 -> JP.Image JP.PixelYA16 toJPImageYA16 = toJPImageUnsafe@@ -451,7 +454,7 @@ maybeJPImageYA16 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel (Alpha cs) Word16))+ forall cs. (Typeable cs, Storable (Pixel (Alpha cs) Word16)) => Image S (Alpha cs) Word16 -> Maybe (JP.Image JP.PixelYA16) maybeJPImageYA16 img =@@ -464,13 +467,13 @@ -toJPImageRGB8 :: Source r Ix2 (Pixel CM.RGB Word8) => Image r CM.RGB Word8 -> JP.Image JP.PixelRGB8+toJPImageRGB8 :: Source r (Pixel CM.RGB Word8) => Image r CM.RGB Word8 -> JP.Image JP.PixelRGB8 toJPImageRGB8 = toJPImageUnsafe {-# INLINE toJPImageRGB8 #-} maybeJPImageRGB8 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word8))+ forall cs. (Typeable cs, Storable (Pixel cs Word8)) => Image S cs Word8 -> Maybe (JP.Image JP.PixelRGB8) maybeJPImageRGB8 img =@@ -483,12 +486,12 @@ toJPImageRGB16 ::- Source r Ix2 (Pixel CM.RGB Word16) => Image r CM.RGB Word16 -> JP.Image JP.PixelRGB16+ Source r (Pixel CM.RGB Word16) => Image r CM.RGB Word16 -> JP.Image JP.PixelRGB16 toJPImageRGB16 = toJPImageUnsafe {-# INLINE toJPImageRGB16 #-} maybeJPImageRGB16 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word16))+ forall cs. (Typeable cs, Storable (Pixel cs Word16)) => Image S cs Word16 -> Maybe (JP.Image JP.PixelRGB16) maybeJPImageRGB16 img =@@ -500,12 +503,12 @@ {-# INLINE maybeJPImageRGB16 #-} -toJPImageRGBF :: Source r Ix2 (Pixel CM.RGB Float) => Image r CM.RGB Float -> JP.Image JP.PixelRGBF+toJPImageRGBF :: Source r (Pixel CM.RGB Float) => Image r CM.RGB Float -> JP.Image JP.PixelRGBF toJPImageRGBF = toJPImageUnsafe {-# INLINE toJPImageRGBF #-} maybeJPImageRGBF ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Float))+ forall cs. (Typeable cs, Storable (Pixel cs Float)) => Image S cs Float -> Maybe (JP.Image JP.PixelRGBF) maybeJPImageRGBF img =@@ -518,14 +521,14 @@ toJPImageRGBA8 ::- Source r Ix2 (Pixel (Alpha CM.RGB) Word8)+ Source r (Pixel (Alpha CM.RGB) Word8) => Image r (Alpha CM.RGB) Word8 -> JP.Image JP.PixelRGBA8 toJPImageRGBA8 = toJPImageUnsafe {-# INLINE toJPImageRGBA8 #-} maybeJPImageRGBA8 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel (Alpha cs) Word8))+ forall cs. (Typeable cs, Storable (Pixel (Alpha cs) Word8)) => Image S (Alpha cs) Word8 -> Maybe (JP.Image JP.PixelRGBA8) maybeJPImageRGBA8 img =@@ -539,14 +542,14 @@ toJPImageRGBA16 ::- Source r Ix2 (Pixel (Alpha CM.RGB) Word16)+ Source r (Pixel (Alpha CM.RGB) Word16) => Image r (Alpha CM.RGB) Word16 -> JP.Image JP.PixelRGBA16 toJPImageRGBA16 = toJPImageUnsafe {-# INLINE toJPImageRGBA16 #-} maybeJPImageRGBA16 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel (Alpha cs) Word16))+ forall cs. (Typeable cs, Storable (Pixel (Alpha cs) Word16)) => Image S (Alpha cs) Word16 -> Maybe (JP.Image JP.PixelRGBA16) maybeJPImageRGBA16 img =@@ -560,13 +563,13 @@ {-# INLINE maybeJPImageRGBA16 #-} toJPImageYCbCr8 ::- Source r Ix2 (Pixel CM.YCbCr Word8) => Image r CM.YCbCr Word8 -> JP.Image JP.PixelYCbCr8+ Source r (Pixel CM.YCbCr Word8) => Image r CM.YCbCr Word8 -> JP.Image JP.PixelYCbCr8 toJPImageYCbCr8 = toJPImageUnsafe {-# INLINE toJPImageYCbCr8 #-} maybeJPImageYCbCr8 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word8))+ forall cs. (Typeable cs, Storable (Pixel cs Word8)) => Image S cs Word8 -> Maybe (JP.Image JP.PixelYCbCr8) maybeJPImageYCbCr8 img =@@ -579,13 +582,13 @@ toJPImageCMYK8 ::- Source r Ix2 (Pixel CM.CMYK Word8) => Image r CM.CMYK Word8 -> JP.Image JP.PixelCMYK8+ Source r (Pixel CM.CMYK Word8) => Image r CM.CMYK Word8 -> JP.Image JP.PixelCMYK8 toJPImageCMYK8 = toJPImageUnsafe {-# INLINE toJPImageCMYK8 #-} maybeJPImageCMYK8 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word8))+ forall cs. (Typeable cs, Storable (Pixel cs Word8)) => Image S cs Word8 -> Maybe (JP.Image JP.PixelCMYK8) maybeJPImageCMYK8 img =@@ -600,13 +603,13 @@ toJPImageCMYK16 ::- Source r Ix2 (Pixel CM.CMYK Word16) => Image r CM.CMYK Word16 -> JP.Image JP.PixelCMYK16+ Source r (Pixel CM.CMYK Word16) => Image r CM.CMYK Word16 -> JP.Image JP.PixelCMYK16 toJPImageCMYK16 = toJPImageUnsafe {-# INLINE toJPImageCMYK16 #-} maybeJPImageCMYK16 ::- forall cs. (Typeable cs, Source S Ix2 (Pixel cs Word16))+ forall cs. (Typeable cs, Storable (Pixel cs Word16)) => Image S cs Word16 -> Maybe (JP.Image JP.PixelCMYK16) maybeJPImageCMYK16 img =
src/Data/Massiv/Array/IO/Image/JuicyPixels/GIF.hs view
@@ -95,7 +95,7 @@ encodeM GIF opts = encodeM GIF opts . toImageBaseModel encodePalettizedRGB ::- (MonadThrow m, Source r Ix2 (Pixel CM.RGB Word8))+ (MonadThrow m, Source r (Pixel CM.RGB Word8)) => GifOptions -> Image r CM.RGB Word8 -> m BL.ByteString@@ -103,7 +103,7 @@ encodeError . uncurry JP.encodeGifImageWithPalette . JP.palettize gifPaletteOptions . toJPImageRGB8 -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto GIF) (Image r cs e) where encodeM = encodeAutoGIF @@ -136,7 +136,7 @@ -- | Decode a Gif Image decodeAutoGIF ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto GIF -> B.ByteString -> m (Image r cs e)@@ -144,14 +144,14 @@ -- | Decode a Gif Image decodeAutoWithMetadataGIF ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto GIF -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataGIF f bs = convertAutoWithMetadata f (JP.decodeGifWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto GIF) (Image r cs e) where decodeM = decodeAutoGIF decodeWithMetadataM = decodeAutoWithMetadataGIF@@ -183,7 +183,7 @@ encodeAutoGIF ::- forall r cs i e m. (ColorSpace cs i e, Source r Ix2 (Pixel cs e), MonadThrow m)+ forall r cs i e m. (ColorSpace cs i e, Source r (Pixel cs e), MonadThrow m) => Auto GIF -> GifOptions -> Image r cs e@@ -231,7 +231,7 @@ decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto (Sequence GIF)) [Image r cs e] where decodeM = decodeAutoSequenceGIF decodeWithMetadataM = decodeAutoSequenceWithMetadataGIF@@ -252,7 +252,7 @@ -- | Decode a sequence of Gif images decodeAutoSequenceGIF ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto (Sequence GIF) -> B.ByteString -> m [Image r cs e]@@ -260,7 +260,7 @@ -- | Decode a sequence of Gif images decodeAutoSequenceWithMetadataGIF ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto (Sequence GIF) -> B.ByteString -> m ([Image r cs e], [JP.GifDelay])@@ -378,7 +378,7 @@ encodeM f opts = encodeM f opts . fmap (\(dl, dp, i) -> (dl, dp, toImageBaseModel i)) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Writable (Auto (Sequence GIF)) (NE.NonEmpty (JP.GifDelay, Image r cs e)) where encodeM (Auto f) opts = encodeM f opts .
src/Data/Massiv/Array/IO/Image/JuicyPixels/HDR.hs view
@@ -75,7 +75,7 @@ instance Writable HDR (Image S (SRGB 'NonLinear) Float) where encodeM f opts = encodeM f opts . toImageBaseModel -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto HDR) (Image r cs e) where encodeM f opts = pure . encodeAutoHDR f opts @@ -98,7 +98,7 @@ -- | Decode a HDR Image decodeAutoHDR ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto HDR -> B.ByteString -> m (Image r cs e)@@ -106,13 +106,13 @@ -- | Decode a HDR Image decodeAutoWithMetadataHDR ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto HDR -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataHDR f bs = convertAutoWithMetadata f (JP.decodeHDRWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto HDR) (Image r cs e) where decodeM = decodeAutoHDR decodeWithMetadataM = decodeAutoWithMetadataHDR@@ -132,7 +132,7 @@ encodeAutoHDR ::- forall r cs i e. (ColorSpace cs i e, Source r Ix2 (Pixel cs e))+ forall r cs i e. (ColorSpace cs i e, Source r (Pixel cs e)) => Auto HDR -> HdrOptions -> Image r cs e@@ -140,5 +140,5 @@ encodeAutoHDR _ opts = toHdr (toPixelBaseModel . toSRGBF) where toSRGBF = convertPixel :: Pixel cs e -> Pixel (SRGB 'NonLinear) Float- toHdr :: Source r Ix2 a => (a -> Pixel CM.RGB Float) -> Array r Ix2 a -> BL.ByteString+ toHdr :: Source r a => (a -> Pixel CM.RGB Float) -> Array r Ix2 a -> BL.ByteString toHdr adjustPixel = getHdrEncoder opts . toJPImageRGBF . A.map adjustPixel
src/Data/Massiv/Array/IO/Image/JuicyPixels/JPG.hs view
@@ -101,7 +101,7 @@ instance Writable JPG (Image S (CMYK (SRGB 'NonLinear)) Word8) where encodeM f opts = encodeM f opts . toImageBaseModel -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto JPG) (Image r cs e) where encodeM f opts = pure . encodeAutoJPG f opts @@ -155,7 +155,7 @@ -- | Decode a Jpeg Image decodeAutoJPG ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto JPG -> B.ByteString -> m (Image r cs e)@@ -163,13 +163,13 @@ -- | Decode a Jpeg Image decodeAutoWithMetadataJPG ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto JPG -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataJPG f bs = convertAutoWithMetadata f (JP.decodeJpegWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto JPG) (Image r cs e) where decodeM = decodeAutoJPG decodeWithMetadataM = decodeAutoWithMetadataJPG@@ -199,7 +199,7 @@ encodeAutoJPG ::- forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e))+ forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto JPG -> JpegOptions -> Image r cs e@@ -220,7 +220,7 @@ ] where toJpeg ::- (JP.JpgEncodable px, Source r ix a)+ (JP.JpgEncodable px, Source r a, Index ix) => (Array D ix b -> JP.Image px) -> (a -> b) -> Array r ix a
src/Data/Massiv/Array/IO/Image/JuicyPixels/PNG.hs view
@@ -116,7 +116,7 @@ instance Writable PNG (Image S (Alpha (SRGB 'NonLinear)) Word16) where encodeM f opts = encodeM f opts . toImageBaseModel -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto PNG) (Image r cs e) where encodeM f _ = pure . encodeAutoPNG f @@ -194,7 +194,7 @@ -- | Decode a Png Image decodeAutoPNG ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto PNG -> B.ByteString -> m (Image r cs e)@@ -202,13 +202,13 @@ -- | Decode a Png Image decodeAutoWithMetadataPNG ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto PNG -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataPNG f bs = convertAutoWithMetadata f (JP.decodePngWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto PNG) (Image r cs e) where decodeM = decodeAutoPNG decodeWithMetadataM = decodeAutoWithMetadataPNG@@ -240,7 +240,7 @@ encodeAutoPNG ::- forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e))+ forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto PNG -> Image r cs e -> BL.ByteString@@ -272,7 +272,7 @@ ] where toPng ::- (JP.PngSavable px, Source r ix a)+ (JP.PngSavable px, Source r a, Index ix) => (Array D ix b -> JP.Image px) -> (a -> b) -> Array r ix a
src/Data/Massiv/Array/IO/Image/JuicyPixels/TGA.hs view
@@ -79,7 +79,7 @@ encodeM f opts = encodeM f opts . toImageBaseModel -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto TGA) (Image r cs e) where encodeM f _ = pure . encodeAutoTGA f @@ -118,7 +118,7 @@ -- | Decode a Tga Image decodeAutoTGA ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TGA -> B.ByteString -> m (Image r cs e)@@ -126,14 +126,14 @@ -- | Decode a Tga Image decodeAutoWithMetadataTGA ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TGA -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataTGA f bs = convertAutoWithMetadata f (JP.decodeTgaWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto TGA) (Image r cs e) where decodeWithMetadataM = decodeAutoWithMetadataTGA @@ -159,7 +159,7 @@ forall r cs i e. ( ColorSpace (BaseSpace cs) i e , ColorSpace cs i e- , Source r Ix2 (Pixel cs e)+ , Source r (Pixel cs e) ) => Auto TGA -> Image r cs e@@ -180,7 +180,7 @@ ] where toTga ::- (JP.TgaSaveable px, Source r ix a)+ (JP.TgaSaveable px, Source r a, Index ix) => (Array D ix b -> JP.Image px) -> (a -> b) -> Array r ix a
src/Data/Massiv/Array/IO/Image/JuicyPixels/TIF.hs view
@@ -159,7 +159,7 @@ instance Writable TIF (Image S (CMYK (SRGB 'NonLinear)) Word16) where encodeM f opts = encodeM f opts . toImageBaseModel -instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r Ix2 (Pixel cs e)) =>+instance (ColorSpace cs i e, ColorSpace (BaseSpace cs) i e, Source r (Pixel cs e)) => Writable (Auto TIF) (Image r cs e) where encodeM f _ = pure . encodeAutoTIF f @@ -267,7 +267,7 @@ -- | Decode a Tiff Image decodeAutoTIF ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TIF -> B.ByteString -> m (Image r cs e)@@ -275,13 +275,13 @@ -- | Decode a Tiff Image decodeAutoWithMetadataTIF ::- (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e, MonadThrow m)+ (Manifest r (Pixel cs e), ColorSpace cs i e, MonadThrow m) => Auto TIF -> B.ByteString -> m (Image r cs e, JP.Metadatas) decodeAutoWithMetadataTIF f bs = convertAutoWithMetadata f (JP.decodeTiffWithMetadata bs) -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto TIF) (Image r cs e) where decodeM = decodeAutoTIF decodeWithMetadataM = decodeAutoWithMetadataTIF@@ -321,7 +321,7 @@ encodeAutoTIF ::- forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r Ix2 (Pixel cs e))+ forall r cs i e. (ColorSpace (BaseSpace cs) i e, ColorSpace cs i e, Source r (Pixel cs e)) => Auto TIF -> Image r cs e -> BL.ByteString@@ -375,7 +375,7 @@ ] where toTiff ::- (JP.TiffSaveable px, Source r ix a)+ (JP.TiffSaveable px, Source r a, Index ix) => (Array D ix b -> JP.Image px) -> (a -> b) -> Array r ix a
src/Data/Massiv/Array/IO/Image/Netpbm.hs view
@@ -106,7 +106,7 @@ -- -- @since 0.2.0 decodeAutoNetpbmImage ::- (FileFormat f, Mutable r Ix2 (Pixel cs e), MonadThrow m, ColorSpace cs i e)+ (FileFormat f, Manifest r (Pixel cs e), MonadThrow m, ColorSpace cs i e) => f -> B.ByteString -> m (Image r cs e, Maybe B.ByteString)@@ -116,13 +116,13 @@ -- -- @since 0.2.0 decodeAutoNetpbmImageSequence ::- (FileFormat (Sequence f), Mutable r Ix2 (Pixel cs e), MonadThrow m, ColorSpace cs i e)+ (FileFormat (Sequence f), Manifest r (Pixel cs e), MonadThrow m, ColorSpace cs i e) => Auto (Sequence f) -> B.ByteString -> m ([Image r cs e], Maybe B.ByteString) decodeAutoNetpbmImageSequence = decodePPMs fromNetpbmImageAuto -decodePPMs :: (FileFormat f, Mutable r Ix2 (Pixel cs e), ColorModel cs e, MonadThrow m) =>+decodePPMs :: (FileFormat f, Manifest r (Pixel cs e), ColorModel cs e, MonadThrow m) => (Netpbm.PPM -> Maybe (Image r cs e)) -> f -> B.ByteString@@ -137,7 +137,7 @@ {-# INLINE decodePPMs #-} -decodePPM :: (FileFormat f, Mutable r Ix2 (Pixel cs e), ColorModel cs e, MonadThrow m) =>+decodePPM :: (FileFormat f, Manifest r (Pixel cs e), ColorModel cs e, MonadThrow m) => (Netpbm.PPM -> Maybe (Image r cs e)) -> f -> B.ByteString@@ -259,29 +259,29 @@ fromNetpbmImageUnsafe m n v -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto PBM) (Image r cs e) where decodeWithMetadataM = decodeAutoNetpbmImage-instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto (Sequence PBM)) [Image r cs e] where decodeWithMetadataM = decodeAutoNetpbmImageSequence -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto PGM) (Image r cs e) where decodeWithMetadataM = decodeAutoNetpbmImage-instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto (Sequence PGM)) [Image r cs e] where decodeWithMetadataM = decodeAutoNetpbmImageSequence -instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto PPM) (Image r cs e) where decodeWithMetadataM = decodeAutoNetpbmImage-instance (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+instance (Manifest r (Pixel cs e), ColorSpace cs i e) => Readable (Auto (Sequence PPM)) [Image r cs e] where decodeWithMetadataM = decodeAutoNetpbmImageSequence fromNetpbmImageAuto- :: forall cs i e r . (Mutable r Ix2 (Pixel cs e), ColorSpace cs i e) =>+ :: forall cs i e r . (Manifest r (Pixel cs e), ColorSpace cs i e) => Netpbm.PPM -> Maybe (Image r cs e) fromNetpbmImageAuto Netpbm.PPM {..} = do let m = ppmHeight ppmHeader
tests/Main.hs view
@@ -1,10 +1,11 @@ module Main where -import Spec-import System.IO (BufferMode (LineBuffering), hSetBuffering, stdout)+import Spec (spec)+import System.IO (BufferMode (LineBuffering), hSetBuffering, hSetEncoding, stdout, utf8) import Test.Hspec main :: IO () main = do hSetBuffering stdout LineBuffering+ hSetEncoding stdout utf8 hspec spec
tests/Spec.hs view
@@ -1,1 +1,1 @@-{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --no-main #-}+{-# OPTIONS_GHC -F -pgmF hspec-discover -optF --module-name=Spec #-}
tests/Test/Massiv/Array/IO/Image/Common.hs view
@@ -7,8 +7,8 @@ module Test.Massiv.Array.IO.Image.Common where import qualified Data.ByteString.Lazy as BL-import Data.List.NonEmpty as NE (NonEmpty(..))-import Data.Massiv.Array+import Data.List.NonEmpty as NE (NonEmpty(..), fromList)+import Data.Massiv.Array as A import Data.Massiv.Array.IO import System.Random import Test.Massiv.Core@@ -122,5 +122,6 @@ arrs <- toSameSizeNE <$> (arbitrary :: Gen (ArrNE D Ix3 (Pixel cs e))) Prelude.mapM (\i -> (,) <$> arbitrary <*> pure (compute i)) arrs -toSameSizeNE :: OuterSlice r ix e => ArrNE r ix e -> NonEmpty (Elt r ix e)-toSameSizeNE (ArrNE arr) = (arr !>) <$> (0 :| [1 .. unSz (fst (unconsSz (size arr))) - 1])+toSameSizeNE ::+ (Index ix, Index (Lower ix), Source r e) => ArrNE r ix e -> NonEmpty (Array r (Lower ix) e)+toSameSizeNE (ArrNE arr) = NE.fromList $ A.toList $ outerSlices arr
tests/doctests.hs view
@@ -1,6 +1,17 @@+{-# LANGUAGE CPP #-} module Main where +#if __GLASGOW_HASKELL__ >= 802 && __GLASGOW_HASKELL__ < 810+ import Test.DocTest (doctest) main :: IO () main = doctest ["src"]++#else++-- TODO: fix doctest support+main :: IO ()+main = putStrLn "\nDoctests are not supported for ghc version 8.2 and prior as well as 8.10\n"++#endif