packages feed

massiv-io 0.3.0.1 → 0.4.0.0

raw patch · 17 files changed

+225/−240 lines, 17 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') e) -> Array S Ix2 (Pixel (Alpha Y) e)
+ 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' e) -> Array S Ix2 (Pixel Y 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 Y) e) -> Array S Ix2 (Pixel (Alpha Y') 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 Y e) -> Array S Ix2 (Pixel Y' e)
+ Data.Massiv.Array.IO: promoteLumaImage :: Array S Ix2 (Pixel X e) -> Array S Ix2 (Pixel (Y' cs) e)
- Data.Massiv.Array.IO: toJPImageY16 :: Source r Ix2 (Pixel Y Word16) => Image r Y Word16 -> Image Pixel16
+ Data.Massiv.Array.IO: toJPImageY16 :: Source r Ix2 (Pixel X Word16) => Image r X Word16 -> Image Pixel16
- Data.Massiv.Array.IO: toJPImageY32 :: Source r Ix2 (Pixel Y Word32) => Image r Y Word32 -> Image Pixel32
+ Data.Massiv.Array.IO: toJPImageY32 :: Source r Ix2 (Pixel X Word32) => Image r X Word32 -> Image Pixel32
- Data.Massiv.Array.IO: toJPImageY8 :: Source r Ix2 (Pixel Y Word8) => Image r Y Word8 -> Image Pixel8
+ Data.Massiv.Array.IO: toJPImageY8 :: Source r Ix2 (Pixel X Word8) => Image r X Word8 -> Image Pixel8
- Data.Massiv.Array.IO: toJPImageYA16 :: Source r Ix2 (Pixel (Alpha Y) Word16) => Image r (Alpha Y) Word16 -> Image PixelYA16
+ Data.Massiv.Array.IO: toJPImageYA16 :: Source r Ix2 (Pixel (Alpha X) Word16) => Image r (Alpha X) Word16 -> Image PixelYA16
- Data.Massiv.Array.IO: toJPImageYA8 :: Source r Ix2 (Pixel (Alpha Y) Word8) => Image r (Alpha Y) Word8 -> Image PixelYA8
+ Data.Massiv.Array.IO: toJPImageYA8 :: Source r Ix2 (Pixel (Alpha X) Word8) => Image r (Alpha X) Word8 -> Image PixelYA8
- Data.Massiv.Array.IO: toJPImageYF :: Source r Ix2 (Pixel Y Float) => Image r Y Float -> Image PixelF
+ Data.Massiv.Array.IO: toJPImageYF :: Source r Ix2 (Pixel X Float) => Image r X Float -> Image PixelF

Files

CHANGELOG.md view
@@ -1,3 +1,8 @@+# 0.4.0++* Adjust insatnces to account for changes in `Color-0.3.0`, namely improvements to Luma+  (`Y'`) and `Y'CBCr` color spaces.+ # 0.3.0  * Support for `Color-0.2.0`, in particular addition of `Linearity` kind to `RGB` color
massiv-io.cabal view
@@ -1,5 +1,5 @@ name:                massiv-io-version:             0.3.0.1+version:             0.4.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
src/Data/Massiv/Array/IO.hs view
@@ -4,8 +4,6 @@ {-# LANGUAGE GADTs #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE ScopedTypeVariables #-}-{-# LANGUAGE TypeOperators #-}-{-# LANGUAGE TypeSynonymInstances #-} -- | -- Module      : Data.Massiv.Array.IO -- Copyright   : (c) Alexey Kuleshevich 2018-2020@@ -131,7 +129,7 @@ -- | Write an array to disk. -- -- >>> :set -XDataKinds--- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (Y'CbCr SRGB) Word8) -- >>> frogAdobeRGB = convertImage frogYCbCr :: Image D (AdobeRGB 'NonLinear) Word8 -- >>> writeArray JPG def "files/_frog.jpg" $ toImageBaseModel $ computeAs S frogAdobeRGB --@@ -161,7 +159,7 @@ -- Resulting image will be read as specified by the type signature: -- -- >>> :set -XDataKinds--- >>> frog <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> frog <- readImage "files/frog.jpg" :: IO (Image S (Y'CbCr SRGB) Word8) -- >>> size frog -- Sz (200 :. 320) --@@ -179,7 +177,7 @@ -- `readImageAuto` or manually convert to the desired one by using the appropriate -- conversion functions: ----- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (Y'CbCr SRGB) Word8) -- >>> let frogSRGB = convertImage frogYCbCr :: Image D (SRGB 'NonLinear) Word8 -- -- A simpler approach to achieve the same effect would be to use `readImageAuto`:@@ -236,7 +234,7 @@ -- on then it will be encoded as such. For example writing a TIF file in CMYK color model, -- 8bit precision and an sRGB color space: ----- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (YCbCr (SRGB 'NonLinear)) Word8)+-- >>> frogYCbCr <- readImage "files/frog.jpg" :: IO (Image S (Y'CbCr SRGB) Word8) -- >>> writeImageAuto "files/frog.tiff" (convertImage frogYCbCr :: Image D (CMYK (AdobeRGB 'NonLinear)) Word8) -- -- Regardless that the color space supplied was `AdobeRGB` auto conversion will ensure it@@ -374,9 +372,9 @@ * 'JPG':      * __read__: ('PixelY' 'Word8'), ('PixelYA' 'Word8'), ('PixelRGB' 'Word8'), ('PixelCMYK' 'Word8'),-    ('PixelYCbCr', 'Word8')+    (`PixelY'CbCr`, 'Word8')     * __write__: ('PixelY' 'Word8'), ('PixelRGB' 'Word8'), ('PixelCMYK' 'Word8'),-    ('PixelYCbCr', 'Word8')+    (`PixelY'CbCr`, 'Word8')  * 'PNG': @@ -401,7 +399,7 @@     ('PixelY' 'Word8'), ('PixelY' 'Word16'), ('PixelY' 'Word32'), ('PixelY' 'Float'),     ('PixelYA' 'Word8'), ('PixelYA' 'Word16'),     ('PixelRGB' 'Word8'), ('PixelRGB' 'Word16'), ('PixelRGBA' 'Word8'), ('PixelRGBA' 'Word16')-    ('PixelCMYK' 'Word8'), ('PixelCMYK' 'Word16'), ('PixelYCbCr' 'Word8')+    ('PixelCMYK' 'Word8'), ('PixelCMYK' 'Word16'), (`PixelY'CbCr` 'Word8')  * 'PBM': 
src/Data/Massiv/Array/IO/Base.hs view
@@ -54,13 +54,14 @@ import qualified Data.ByteString.Lazy as BL (ByteString) import Data.Default.Class (Default(..)) import qualified Data.Massiv.Array as A-import Data.Massiv.Array.Manifest.Vector import Data.Typeable import qualified Data.Vector.Storable as V import Graphics.Pixel as CM import Graphics.Pixel.ColorSpace 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)  -- | Conversion error, which is thrown when there is a mismatch between the@@ -279,34 +280,37 @@   -- | Cast an array with Luma pixels to an array with pixels in a plain single channel--- `CM.Y` color model+-- `CM.X` color model -- -- @since 0.2.1-demoteLumaImage :: A.Array A.S A.Ix2 (Pixel Y' e) -> A.Array A.S A.Ix2 (Pixel CM.Y e)+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.Y` color model to an array+-- | 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.Y e) -> A.Array A.S A.Ix2 (Pixel Y' e)+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') e) -> A.Array A.S A.Ix2 (Pixel (Alpha CM.Y) e)+     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.Y) e) -> A.Array A.S A.Ix2 (Pixel (Alpha Y') e)+     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`" #-}   
src/Data/Massiv/Array/IO/Image.hs view
@@ -4,7 +4,6 @@ {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE TypeApplications #-}-{-# LANGUAGE TypeSynonymInstances #-} -- | -- Module      : Data.Massiv.Array.IO.Image -- Copyright   : (c) Alexey Kuleshevich 2018-2020@@ -73,7 +72,7 @@   -> m BL.ByteString encodeImageM formats path img = do   let ext' = P.map toLower . takeExtension $ path-  case dropWhile (not . isFormat ext') formats of+  case P.dropWhile (not . isFormat ext') formats of     []    -> throwM $ EncodeError $ "File format is not supported: " ++ ext'     (f:_) -> encodeM f () img @@ -138,7 +137,7 @@   -> m (Image r cs e) decodeImageM formats path bs = do   let ext' = P.map toLower . takeExtension $ path-  case dropWhile (not . isFormat ext') formats of+  case P.dropWhile (not . isFormat ext') formats of     []    -> throwM $ DecodeError $ "File format is not supported: " ++ ext'     (f:_) -> decodeM f bs 
src/Data/Massiv/Array/IO/Image/JuicyPixels/BMP.hs view
@@ -3,8 +3,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -64,7 +62,7 @@    ext _ = ".bmp" -instance Writable BMP (Image S CM.Y Word8) where+instance Writable BMP (Image S CM.X Word8) where   encodeM BMP BitmapOptions {bitmapMetadata} =     pure . JP.encodeBitmapWithMetadata bitmapMetadata . toJPImageY8 @@ -77,8 +75,8 @@     pure . JP.encodeBitmapWithMetadata bitmapMetadata . toJPImageRGBA8  -instance Writable BMP (Image S Y' Word8) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable BMP (Image S (Y' SRGB) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable BMP (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel@@ -94,7 +92,7 @@   encodeM f opts = pure . encodeAutoBMP f opts  -instance Readable BMP (Image S CM.Y Word8) where+instance Readable BMP (Image S CM.X Word8) where   decodeWithMetadataM = decodeWithMetadataBMP  instance Readable BMP (Image S CM.RGB Word8) where@@ -103,8 +101,8 @@ instance Readable BMP (Image S (Alpha CM.RGB) Word8) where   decodeWithMetadataM = decodeWithMetadataBMP -instance Readable BMP (Image S Y' Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable BMP (Image S (Y' SRGB) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  instance Readable BMP (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f@@ -173,7 +171,7 @@ encodeAutoBMP _ BitmapOptions {bitmapMetadata} img =   fromMaybe (toBitmap toJPImageRGB8 toSRGB8 img) $   msum-    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.Y)+    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Bit)                 pure $ toBitmap toJPImageY8 (toPixel8 . toPixelBaseModel) img
src/Data/Massiv/Array/IO/Image/JuicyPixels/Base.hs view
@@ -4,8 +4,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -164,38 +162,38 @@   case jpDynImg of     JP.ImageY8 jimg ->       sequenceMaybe-        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel Y' Word8))+        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y' SRGB) Word8))         , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y D65) Word8))         ]     JP.ImageY16 jimg ->       sequenceMaybe-        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel Y' Word16))+        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y' SRGB) Word16))         , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y D65) Word16))         ]     JP.ImageY32 jimg ->       sequenceMaybe-        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word32))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel Y' Word32))+        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word32))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y' SRGB) Word32))         , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y D65) Word32))         ]     JP.ImageYF jimg ->       sequenceMaybe-        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Float))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel Y' Float))+        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.X Float))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y' SRGB) Float))         , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y D65) Float))         ]     JP.ImageYA8 jimg ->       sequenceMaybe-        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.Y) Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha Y') Word8))+        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.X) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (Y' SRGB)) Word8))         , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (Y D65)) Word8))         ]     JP.ImageYA16 jimg ->       sequenceMaybe-        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.Y) Word16))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha Y') Word16))+        [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.X) Word16))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (Y' SRGB)) Word16))         , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Alpha (Y D65)) Word16))         ]     JP.ImageRGB8 jimg ->@@ -231,8 +229,8 @@     JP.ImageYCbCr8 jimg ->       sequenceMaybe         [ fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel CM.YCbCr Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (YCbCr (SRGB 'NonLinear)) Word8))-        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (YCbCr (AdobeRGB 'NonLinear)) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y'CbCr SRGB) Word8))+        , fromJPImageM jimg (eqT :: Maybe (Pixel cs e :~: Pixel (Y'CbCr AdobeRGB) Word8))         ]     JP.ImageCMYK8 jimg ->       sequenceMaybe@@ -254,22 +252,22 @@ fromDynamicImage jpDynImg =   case jpDynImg of     JP.ImageY8 jimg -> do-      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word8)+      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word8)       fromJPImageUnsafeM jimg     JP.ImageY16 jimg -> do-      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word16)+      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word16)       fromJPImageUnsafeM jimg     JP.ImageY32 jimg -> do-      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word32)+      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word32)       fromJPImageUnsafeM jimg     JP.ImageYF jimg -> do-      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Float)+      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Float)       fromJPImageUnsafeM jimg     JP.ImageYA8 jimg -> do-      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.Y) Word8)+      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.X) Word8)       fromJPImageUnsafeM jimg     JP.ImageYA16 jimg -> do-      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.Y) Word16)+      Refl <- eqT :: Maybe (Pixel cs e :~: Pixel (Alpha CM.X) Word16)       fromJPImageUnsafeM jimg     JP.ImageRGB8 jimg -> do       Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.RGB Word8)@@ -329,7 +327,7 @@       (fromJPImageUnsafeM jimg :: m (Image S (Alpha (SRGB 'NonLinear)) Word16))     JP.ImageYCbCr8 jimg ->       compute . convertImage <$>-      (fromJPImageUnsafeM jimg :: m (Image S (YCbCr (SRGB 'NonLinear)) Word8))+      (fromJPImageUnsafeM jimg :: m (Image S (Y'CbCr SRGB) Word8))     JP.ImageCMYK8 jimg ->       compute . convertImage <$>       (fromJPImageUnsafeM jimg :: m (Image S (CMYK (SRGB 'NonLinear)) Word8))@@ -369,7 +367,7 @@     Sz (m :. n) = size img {-# INLINE toJPImageUnsafe #-} -toJPImageY8 :: Source r Ix2 (Pixel CM.Y Word8) => Image r CM.Y Word8 -> JP.Image JP.Pixel8+toJPImageY8 :: Source r Ix2 (Pixel CM.X Word8) => Image r CM.X Word8 -> JP.Image JP.Pixel8 toJPImageY8 = toJPImageUnsafe {-# INLINE toJPImageY8 #-} @@ -379,13 +377,13 @@   -> Maybe (JP.Image JP.Pixel8) maybeJPImageY8 img =   msum-    [ (\Refl -> toJPImageY8 img) <$> (eqT :: Maybe (cs :~: CM.Y))-    , (\Refl -> toJPImageY8 $ demoteLumaImage img) <$> (eqT :: Maybe (cs :~: Y'))+    [ (\Refl -> toJPImageY8 img) <$> (eqT :: Maybe (cs :~: CM.X))+    , (\Refl -> toJPImageY8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y' SRGB))     , (\Refl -> toJPImageY8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y D65))     ] {-# INLINE maybeJPImageY8 #-} -toJPImageY16 :: Source r Ix2 (Pixel CM.Y Word16) => Image r CM.Y Word16 -> JP.Image JP.Pixel16+toJPImageY16 :: Source r Ix2 (Pixel CM.X Word16) => Image r CM.X Word16 -> JP.Image JP.Pixel16 toJPImageY16 = toJPImageUnsafe {-# INLINE toJPImageY16 #-} @@ -397,13 +395,13 @@   -> Maybe (JP.Image JP.Pixel16) maybeJPImageY16 img =   msum-    [ (\Refl -> toJPImageY16 img) <$> (eqT :: Maybe (cs :~: CM.Y))-    , (\Refl -> toJPImageY16 $ demoteLumaImage img) <$> (eqT :: Maybe (cs :~: Y'))+    [ (\Refl -> toJPImageY16 img) <$> (eqT :: Maybe (cs :~: CM.X))+    , (\Refl -> toJPImageY16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y' SRGB))     , (\Refl -> toJPImageY16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y D65))     ] {-# INLINE maybeJPImageY16 #-} -toJPImageY32 :: Source r Ix2 (Pixel CM.Y Word32) => Image r CM.Y Word32 -> JP.Image JP.Pixel32+toJPImageY32 :: Source r Ix2 (Pixel CM.X Word32) => Image r CM.X Word32 -> JP.Image JP.Pixel32 toJPImageY32 = toJPImageUnsafe {-# INLINE toJPImageY32 #-} @@ -414,14 +412,14 @@   -> Maybe (JP.Image JP.Pixel32) maybeJPImageY32 img =   msum-    [ (\Refl -> toJPImageY32 img) <$> (eqT :: Maybe (cs :~: CM.Y))-    , (\Refl -> toJPImageY32 $ demoteLumaImage img) <$> (eqT :: Maybe (cs :~: Y'))+    [ (\Refl -> toJPImageY32 img) <$> (eqT :: Maybe (cs :~: CM.X))+    , (\Refl -> toJPImageY32 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y' SRGB))     , (\Refl -> toJPImageY32 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y D65))     ] {-# INLINE maybeJPImageY32 #-}  -toJPImageYF :: Source r Ix2 (Pixel CM.Y Float) => Image r CM.Y Float -> JP.Image JP.PixelF+toJPImageYF :: Source r Ix2 (Pixel CM.X Float) => Image r CM.X Float -> JP.Image JP.PixelF toJPImageYF = toJPImageUnsafe {-# INLINE toJPImageYF #-} @@ -432,15 +430,15 @@   -> Maybe (JP.Image JP.PixelF) maybeJPImageYF img =   msum-    [ (\Refl -> toJPImageYF img) <$> (eqT :: Maybe (cs :~: CM.Y))-    , (\Refl -> toJPImageYF $ demoteLumaImage img) <$> (eqT :: Maybe (cs :~: Y'))+    [ (\Refl -> toJPImageYF img) <$> (eqT :: Maybe (cs :~: CM.X))+    , (\Refl -> toJPImageYF $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y' SRGB))     , (\Refl -> toJPImageYF $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y D65))     ] {-# INLINE maybeJPImageYF #-}   toJPImageYA8 ::-     Source r Ix2 (Pixel (Alpha CM.Y) Word8) => Image r (Alpha CM.Y) Word8 -> JP.Image JP.PixelYA8+     Source r Ix2 (Pixel (Alpha CM.X) Word8) => Image r (Alpha CM.X) Word8 -> JP.Image JP.PixelYA8 toJPImageYA8 = toJPImageUnsafe {-# INLINE toJPImageYA8 #-} @@ -450,16 +448,16 @@   -> Maybe (JP.Image JP.PixelYA8) maybeJPImageYA8 img =   msum-    [ (\Refl -> toJPImageYA8 img) <$> (eqT :: Maybe (cs :~: CM.Y))-    , (\Refl -> toJPImageYA8 $ demoteLumaAlphaImage img) <$> (eqT :: Maybe (cs :~: Y'))+    [ (\Refl -> toJPImageYA8 img) <$> (eqT :: Maybe (cs :~: CM.X))+    , (\Refl -> toJPImageYA8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y' SRGB))     , (\Refl -> toJPImageYA8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y D65))     ] {-# INLINE maybeJPImageYA8 #-}   toJPImageYA16 ::-     Source r Ix2 (Pixel (Alpha CM.Y) Word16)-  => Image r (Alpha CM.Y) Word16+     Source r Ix2 (Pixel (Alpha CM.X) Word16)+  => Image r (Alpha CM.X) Word16   -> JP.Image JP.PixelYA16 toJPImageYA16 = toJPImageUnsafe {-# INLINE toJPImageYA16 #-}@@ -471,8 +469,8 @@   -> Maybe (JP.Image JP.PixelYA16) maybeJPImageYA16 img =   msum-    [ (\Refl -> toJPImageYA16 img) <$> (eqT :: Maybe (cs :~: CM.Y))-    , (\Refl -> toJPImageYA16 $ demoteLumaAlphaImage img) <$> (eqT :: Maybe (cs :~: Y'))+    [ (\Refl -> toJPImageYA16 img) <$> (eqT :: Maybe (cs :~: CM.X))+    , (\Refl -> toJPImageYA16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y' SRGB))     , (\Refl -> toJPImageYA16 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y D65))     ] {-# INLINE maybeJPImageYA16 #-}@@ -587,9 +585,8 @@ maybeJPImageYCbCr8 img =   msum     [ (\Refl -> toJPImageYCbCr8 img) <$> (eqT :: Maybe (cs :~: CM.YCbCr))-    , (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$>-      (eqT :: Maybe (cs :~: YCbCr (SRGB 'NonLinear)))-    --, (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: YCbCr (AdobeRGB 'NonLinear)))+    , (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y'CbCr SRGB))+    --, (\Refl -> toJPImageYCbCr8 $ toImageBaseModel img) <$> (eqT :: Maybe (cs :~: Y'CbCr AdobeRGB)))     ] {-# INLINE maybeJPImageYCbCr8 #-} @@ -660,7 +657,7 @@ -- Conversion to sRGB color space based color models  toYCbCr8 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.YCbCr Word8-toYCbCr8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (YCbCr (SRGB 'NonLinear)) Word8)+toYCbCr8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (Y'CbCr SRGB) Word8)  toCMYK8 :: forall cs i e . ColorSpace cs i e => Pixel cs e -> Pixel CM.CMYK Word8 toCMYK8 = toPixelBaseModel . (convertPixel :: Pixel cs e -> Pixel (CMYK (SRGB 'NonLinear)) Word8)
src/Data/Massiv/Array/IO/Image/JuicyPixels/GIF.hs view
@@ -4,8 +4,6 @@ {-# LANGUAGE LambdaCase #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -78,14 +76,14 @@   type Metadata GIF = JP.Metadatas   ext _ = ".gif" -instance Writable GIF (Image S CM.Y Word8) where+instance Writable GIF (Image S CM.X Word8) where   encodeM GIF _ =  pure . JP.encodeGifImage . toJPImageY8  instance Writable GIF (Image S CM.RGB Word8) where   encodeM GIF = encodePalettizedRGB -instance Writable GIF (Image S Y' Word8) where-  encodeM GIF opts = encodeM GIF opts . demoteLumaImage+instance Writable GIF (Image S (Y' SRGB) Word8) where+  encodeM GIF opts = encodeM GIF opts . toImageBaseModel  instance Writable GIF (Image S (Y D65) Word8) where   encodeM GIF opts = encodeM GIF opts . toImageBaseModel@@ -173,10 +171,10 @@           | Just Refl <- (eqT :: Maybe (e :~: Word8))           , Just Refl <- (eqT :: Maybe (cs :~: CM.RGB)) -> encodePalettizedRGB opts img           | Just Refl <- (eqT :: Maybe (e :~: Word8))-          , Just Refl <- (eqT :: Maybe (cs :~: (SRGB 'NonLinear))) ->+          , Just Refl <- (eqT :: Maybe (cs :~: SRGB 'NonLinear)) ->             encodePalettizedRGB opts $ toImageBaseModel img           | Just Refl <- (eqT :: Maybe (e :~: Word8))-          , Just Refl <- (eqT :: Maybe (cs :~: (AdobeRGB 'NonLinear))) ->+          , Just Refl <- (eqT :: Maybe (cs :~: AdobeRGB 'NonLinear)) ->             encodePalettizedRGB opts $ toImageBaseModel img         Nothing -> fromMaybeEncode f (Proxy :: Proxy (Image S cs e)) Nothing @@ -189,7 +187,7 @@   -> m BL.ByteString encodeAutoGIF _ opts img =   fallbackEncodePalettizedRGB $ do-    Refl <- eqT :: Maybe (BaseModel cs :~: CM.Y)+    Refl <- eqT :: Maybe (BaseModel cs :~: CM.X)     pure $ JP.encodeGifImage $ toJPImageY8 $ A.map (toPixel8 . toPixelBaseModel) img   where     fallbackEncodePalettizedRGB =@@ -273,7 +271,7 @@   pure (imgs, delays)  -instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S CM.Y Word8)) where+instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S CM.X Word8)) where   encodeM _ SequenceGifOptions {sequenceGifLooping} gifs =     encodeError $     JP.encodeComplexGifImage $@@ -352,8 +350,8 @@ instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (Alpha CM.RGB) Word8)) where   encodeM f opts = encodeM f opts . fmap (\(d, i) -> (d, JP.DisposalRestoreBackground, i)) -instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S Y' Word8)) where-  encodeM f opts = encodeM f opts . fmap (fmap demoteLumaImage)+instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (Y' SRGB) Word8)) where+  encodeM f opts = encodeM f opts . fmap (fmap toImageBaseModel)  instance Writable (Sequence GIF) (NE.NonEmpty (JP.GifDelay, Image S (Y D65) Word8)) where   encodeM f opts = encodeM f opts . fmap (fmap toImageBaseModel)
src/Data/Massiv/Array/IO/Image/JuicyPixels/HDR.hs view
@@ -3,8 +3,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}
src/Data/Massiv/Array/IO/Image/JuicyPixels/JPG.hs view
@@ -3,8 +3,6 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -69,7 +67,7 @@   ext _ = ".jpg"   exts _ = [".jpg", ".jpeg"] -instance Writable JPG (Image S CM.Y Word8) where+instance Writable JPG (Image S CM.X Word8) where   encodeM JPG JpegOptions {jpegQuality, jpegMetadata} =     pure . JP.encodeDirectJpegAtQualityWithMetadata jpegQuality jpegMetadata . toJPImageY8 @@ -85,8 +83,8 @@   encodeM JPG JpegOptions {jpegQuality, jpegMetadata} =     pure . JP.encodeDirectJpegAtQualityWithMetadata jpegQuality jpegMetadata . toJPImageCMYK8 -instance Writable JPG (Image S Y' Word8) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable JPG (Image S (Y' SRGB) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable JPG (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel@@ -94,7 +92,7 @@ instance Writable JPG (Image S (SRGB 'NonLinear) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable JPG (Image S (YCbCr (SRGB 'NonLinear)) Word8) where+instance Writable JPG (Image S (Y'CbCr SRGB) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable JPG (Image S (CMYK (SRGB 'NonLinear)) Word8) where@@ -105,10 +103,10 @@   encodeM f opts = pure . encodeAutoJPG f opts  -instance Readable JPG (Image S CM.Y Word8) where+instance Readable JPG (Image S CM.X Word8) where   decodeWithMetadataM = decodeWithMetadataJPG -instance Readable JPG (Image S (Alpha CM.Y) Word8) where+instance Readable JPG (Image S (Alpha CM.X) Word8) where   decodeWithMetadataM = decodeWithMetadataJPG  instance Readable JPG (Image S CM.RGB Word8) where@@ -120,11 +118,11 @@ instance Readable JPG (Image S CM.YCbCr Word8) where   decodeWithMetadataM = decodeWithMetadataJPG -instance Readable JPG (Image S Y' Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable JPG (Image S (Y' SRGB) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable JPG (Image S (Alpha Y') Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaAlphaImage) . decodeWithMetadataM f+instance Readable JPG (Image S (Alpha (Y' SRGB)) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  instance Readable JPG (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f@@ -138,7 +136,7 @@ instance Readable JPG (Image S (CMYK (SRGB 'NonLinear)) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable JPG (Image S (YCbCr (SRGB 'NonLinear)) Word8) where+instance Readable JPG (Image S (Y'CbCr SRGB) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  @@ -200,7 +198,7 @@ encodeAutoJPG _ JpegOptions {jpegQuality, jpegMetadata} img =   fromMaybe (toJpeg toJPImageYCbCr8 toYCbCr8 img) $   msum-    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.Y)+    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Bit)                 pure $ toJpeg toJPImageY8 (toPixel8 . toPixelBaseModel) img
src/Data/Massiv/Array/IO/Image/JuicyPixels/PNG.hs view
@@ -2,8 +2,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -54,16 +52,16 @@   type Metadata PNG = JP.Metadatas   ext _ = ".png" -instance Writable PNG (Image S CM.Y Word8) where+instance Writable PNG (Image S CM.X Word8) where   encodeM PNG _ img = pure $ JP.encodePng (toJPImageY8 img) -instance Writable PNG (Image S CM.Y Word16) where+instance Writable PNG (Image S CM.X Word16) where   encodeM PNG _ img = pure $ JP.encodePng (toJPImageY16 img) -instance Writable PNG (Image S (Alpha CM.Y) Word8) where+instance Writable PNG (Image S (Alpha CM.X) Word8) where   encodeM PNG _ img = pure $ JP.encodePng (toJPImageYA8 img) -instance Writable PNG (Image S (Alpha CM.Y) Word16) where+instance Writable PNG (Image S (Alpha CM.X) Word16) where   encodeM PNG _ img = pure $ JP.encodePng (toJPImageYA16 img)  instance Writable PNG (Image S CM.RGB Word8) where@@ -79,17 +77,17 @@   encodeM PNG _ img = pure $ JP.encodePng (toJPImageRGBA16 img)  -instance Writable PNG (Image S Y' Word8) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable PNG (Image S (Y' SRGB) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S Y' Word16) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable PNG (Image S (Y' SRGB) Word16) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S (Alpha Y') Word8) where-  encodeM f opts = encodeM f opts . demoteLumaAlphaImage+instance Writable PNG (Image S (Alpha (Y' SRGB)) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable PNG (Image S (Alpha Y') Word16) where-  encodeM f opts = encodeM f opts . demoteLumaAlphaImage+instance Writable PNG (Image S (Alpha (Y' SRGB)) Word16) where+  encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable PNG (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel@@ -120,16 +118,16 @@   encodeM f _ = pure . encodeAutoPNG f  -instance Readable PNG (Image S CM.Y Word8) where+instance Readable PNG (Image S CM.X Word8) where   decodeWithMetadataM = decodeWithMetadataPNG -instance Readable PNG (Image S CM.Y Word16) where+instance Readable PNG (Image S CM.X Word16) where   decodeWithMetadataM = decodeWithMetadataPNG -instance Readable PNG (Image S (Alpha CM.Y) Word8) where+instance Readable PNG (Image S (Alpha CM.X) Word8) where   decodeWithMetadataM = decodeWithMetadataPNG -instance Readable PNG (Image S (Alpha CM.Y) Word16) where+instance Readable PNG (Image S (Alpha CM.X) Word16) where   decodeWithMetadataM = decodeWithMetadataPNG  instance Readable PNG (Image S CM.RGB Word8) where@@ -145,17 +143,17 @@   decodeWithMetadataM = decodeWithMetadataPNG  -instance Readable PNG (Image S Y' Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataPNG f+instance Readable PNG (Image S (Y' SRGB) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S Y' Word16) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataPNG f+instance Readable PNG (Image S (Y' SRGB) Word16) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S (Alpha Y') Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaAlphaImage) . decodeWithMetadataPNG f+instance Readable PNG (Image S (Alpha (Y' SRGB)) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f -instance Readable PNG (Image S (Alpha Y') Word16) where-  decodeWithMetadataM f = fmap (first promoteLumaAlphaImage) . decodeWithMetadataPNG f+instance Readable PNG (Image S (Alpha (Y' SRGB)) Word16) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f  instance Readable PNG (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataPNG f@@ -246,7 +244,7 @@ encodeAutoPNG _ img =   fromMaybe (toPng toJPImageRGB16 toSRGB16 img) $   msum-    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.Y)+    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Bit)                 pure $ toPng toJPImageY8 (toPixel8 . toPixelBaseModel) img@@ -254,7 +252,7 @@                 pure $ toPng toJPImageY8 toPixelBaseModel img            , pure $ toPng toJPImageY16 (toPixel16 . toPixelBaseModel) img            ]-    , do Refl <- eqT :: Maybe (BaseModel cs :~: Alpha CM.Y)+    , do Refl <- eqT :: Maybe (BaseModel cs :~: Alpha CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Word8)                 pure $ toPng toJPImageYA8 toPixelBaseModel img
src/Data/Massiv/Array/IO/Image/JuicyPixels/TGA.hs view
@@ -2,8 +2,6 @@ {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}@@ -55,7 +53,7 @@   type Metadata TGA = JP.Metadatas   ext _ = ".tga" -instance Writable TGA (Image S CM.Y Word8) where+instance Writable TGA (Image S CM.X Word8) where   encodeM TGA _ img = pure $ JP.encodeTga (toJPImageY8 img)  instance Writable TGA (Image S CM.RGB Word8) where@@ -65,8 +63,8 @@   encodeM TGA _ img = pure $ JP.encodeTga (toJPImageRGBA8 img)  -instance Writable TGA (Image S Y' Word8) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable TGA (Image S (Y' SRGB) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable TGA (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel@@ -83,7 +81,7 @@   encodeM f _ = pure . encodeAutoTGA f  -instance Readable TGA (Image S CM.Y Word8) where+instance Readable TGA (Image S CM.X Word8) where   decodeWithMetadataM = decodeWithMetadataTGA  instance Readable TGA (Image S CM.RGB Word8) where@@ -93,8 +91,8 @@   decodeWithMetadataM = decodeWithMetadataTGA  -instance Readable TGA (Image S Y' Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable TGA (Image S (Y' SRGB) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  instance Readable TGA (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f@@ -164,7 +162,7 @@ encodeAutoTGA _ img =   fromMaybe (toTga toJPImageRGB8 toSRGB8 img) $   msum-    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.Y)+    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Bit)                 pure $ toTga toJPImageY8 (toPixel8 . toPixelBaseModel) img
src/Data/Massiv/Array/IO/Image/JuicyPixels/TIF.hs view
@@ -1,9 +1,7 @@-{-# LANGUAGE BangPatterns #-} {-# LANGUAGE DataKinds #-} {-# LANGUAGE FlexibleContexts #-} {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-}-{-# LANGUAGE PatternSynonyms #-} {-# LANGUAGE RankNTypes #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-}@@ -62,22 +60,22 @@   ext _ = ".tif"   exts _ = [".tif", ".tiff"] -instance Writable TIF (Image S CM.Y Word8) where+instance Writable TIF (Image S CM.X Word8) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageY8 img) -instance Writable TIF (Image S CM.Y Word16) where+instance Writable TIF (Image S CM.X Word16) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageY16 img) -instance Writable TIF (Image S CM.Y Word32) where+instance Writable TIF (Image S CM.X Word32) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageY32 img) -instance Writable TIF (Image S CM.Y Float) where+instance Writable TIF (Image S CM.X Float) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageYF img) -instance Writable TIF (Image S (Alpha CM.Y) Word8) where+instance Writable TIF (Image S (Alpha CM.X) Word8) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageYA8 img) -instance Writable TIF (Image S (Alpha CM.Y) Word16) where+instance Writable TIF (Image S (Alpha CM.X) Word16) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageYA16 img)  instance Writable TIF (Image S CM.RGB Word8) where@@ -101,23 +99,23 @@ instance Writable TIF (Image S CM.CMYK Word16) where   encodeM TIF _ img = pure $ JP.encodeTiff (toJPImageCMYK16 img) -instance Writable TIF (Image S Y' Word8) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable TIF (Image S (Y' SRGB) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S Y' Word16) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable TIF (Image S (Y' SRGB) Word16) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S Y' Word32) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable TIF (Image S (Y' SRGB) Word32) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S Y' Float) where-  encodeM f opts = encodeM f opts . demoteLumaImage+instance Writable TIF (Image S (Y' SRGB) Float) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (Alpha Y') Word8) where-  encodeM f opts = encodeM f opts . demoteLumaAlphaImage+instance Writable TIF (Image S (Alpha (Y' SRGB)) Word8) where+  encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (Alpha Y') Word16) where-  encodeM f opts = encodeM f opts . demoteLumaAlphaImage+instance Writable TIF (Image S (Alpha (Y' SRGB)) Word16) where+  encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable TIF (Image S (Y D65) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel@@ -149,7 +147,7 @@ instance Writable TIF (Image S (Alpha (SRGB 'NonLinear)) Word16) where   encodeM f opts = encodeM f opts . toImageBaseModel -instance Writable TIF (Image S (YCbCr (SRGB 'NonLinear)) Word8) where+instance Writable TIF (Image S (Y'CbCr SRGB) Word8) where   encodeM f opts = encodeM f opts . toImageBaseModel  instance Writable TIF (Image S (CMYK (SRGB 'NonLinear)) Word8) where@@ -163,22 +161,22 @@   encodeM f _ = pure . encodeAutoTIF f  -instance Readable TIF (Image S CM.Y Word8) where+instance Readable TIF (Image S CM.X Word8) where   decodeWithMetadataM = decodeWithMetadataTIF -instance Readable TIF (Image S CM.Y Word16) where+instance Readable TIF (Image S CM.X Word16) where   decodeWithMetadataM = decodeWithMetadataTIF -instance Readable TIF (Image S CM.Y Word32) where+instance Readable TIF (Image S CM.X Word32) where   decodeWithMetadataM = decodeWithMetadataTIF -instance Readable TIF (Image S CM.Y Float) where+instance Readable TIF (Image S CM.X Float) where   decodeWithMetadataM = decodeWithMetadataTIF -instance Readable TIF (Image S (Alpha CM.Y) Word8) where+instance Readable TIF (Image S (Alpha CM.X) Word8) where   decodeWithMetadataM = decodeWithMetadataTIF -instance Readable TIF (Image S (Alpha CM.Y) Word16) where+instance Readable TIF (Image S (Alpha CM.X) Word16) where   decodeWithMetadataM = decodeWithMetadataTIF  instance Readable TIF (Image S CM.RGB Word8) where@@ -200,23 +198,23 @@   decodeWithMetadataM = decodeWithMetadataTIF  -instance Readable TIF (Image S Y' Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable TIF (Image S (Y' SRGB) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S Y' Word16) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable TIF (Image S (Y' SRGB) Word16) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S Y' Word32) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable TIF (Image S (Y' SRGB) Word32) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S Y' Float) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable TIF (Image S (Y' SRGB) Float) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S (Alpha Y') Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaAlphaImage) . decodeWithMetadataM f+instance Readable TIF (Image S (Alpha (Y' SRGB)) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f -instance Readable TIF (Image S (Alpha Y') Word16) where-  decodeWithMetadataM f = fmap (first promoteLumaAlphaImage) . decodeWithMetadataM f+instance Readable TIF (Image S (Alpha (Y' SRGB)) Word16) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  instance Readable TIF (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f@@ -329,7 +327,7 @@ encodeAutoTIF _ img =   fromMaybe (toTiff toJPImageRGB8 toSRGB8 img) $   msum-    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.Y)+    [ do Refl <- eqT :: Maybe (BaseModel cs :~: CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Bit)                 pure $ toTiff toJPImageY8 (toPixel8 . toPixelBaseModel) img@@ -343,7 +341,7 @@                 pure $ toTiff toJPImageYF toPixelBaseModel img            , pure $ toTiff toJPImageY16 (toPixel16 . toPixelBaseModel) img            ]-    , do Refl <- eqT :: Maybe (BaseModel cs :~: Alpha CM.Y)+    , do Refl <- eqT :: Maybe (BaseModel cs :~: Alpha CM.X)          msum            [ do Refl <- eqT :: Maybe (e :~: Word8)                 pure $ toTiff toJPImageYA8 toPixelBaseModel img
src/Data/Massiv/Array/IO/Image/Netpbm.hs view
@@ -3,13 +3,10 @@ {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE NamedFieldPuns #-}-{-# LANGUAGE PatternSynonyms #-}-{-# LANGUAGE RankNTypes #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE ScopedTypeVariables #-} {-# LANGUAGE TypeFamilies #-} {-# LANGUAGE TypeOperators #-}-{-# LANGUAGE TypeSynonymInstances #-} {-# LANGUAGE UndecidableInstances #-} -- | -- Module      : Data.Massiv.Array.IO.Image.Netpbm@@ -175,44 +172,44 @@   -instance Readable PBM (Image S CM.Y Bit) where+instance Readable PBM (Image S CM.X Bit) where   decodeWithMetadataM = decodeNetpbmImage instance Readable PBM (Image S (Y D65) Bit) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  -instance Readable (Sequence PBM) [Image S CM.Y Bit] where+instance Readable (Sequence PBM) [Image S CM.X Bit] where   decodeWithMetadataM = decodePPMs fromNetpbmImage instance Readable (Sequence PBM) [Image S (Y D65) Bit] where   decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f  -instance Readable PGM (Image S CM.Y Word8) where+instance Readable PGM (Image S CM.X Word8) where   decodeWithMetadataM = decodeNetpbmImage-instance Readable PGM (Image S CM.Y Word16) where+instance Readable PGM (Image S CM.X Word16) where   decodeWithMetadataM = decodeNetpbmImage  -instance Readable PGM (Image S Y' Word8) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f-instance Readable PGM (Image S Y' Word16) where-  decodeWithMetadataM f = fmap (first promoteLumaImage) . decodeWithMetadataM f+instance Readable PGM (Image S (Y' SRGB) Word8) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f+instance Readable PGM (Image S (Y' SRGB) Word16) where+  decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f instance Readable PGM (Image S (Y D65) Word8) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f instance Readable PGM (Image S (Y D65) Word16) where   decodeWithMetadataM f = fmap (first fromImageBaseModel) . decodeWithMetadataM f  -instance Readable (Sequence PGM) [Image S CM.Y Word8] where+instance Readable (Sequence PGM) [Image S CM.X Word8] where   decodeWithMetadataM = decodePPMs fromNetpbmImage-instance Readable (Sequence PGM) [Image S CM.Y Word16] where+instance Readable (Sequence PGM) [Image S CM.X Word16] where   decodeWithMetadataM = decodePPMs fromNetpbmImage  -instance Readable (Sequence PGM) [Image S Y' Word8] where-  decodeWithMetadataM f = fmap (first (fmap promoteLumaImage)) . decodeWithMetadataM f-instance Readable (Sequence PGM) [Image S Y' Word16] where-  decodeWithMetadataM f = fmap (first (fmap promoteLumaImage)) . decodeWithMetadataM f+instance Readable (Sequence PGM) [Image S (Y' SRGB) Word8] where+  decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f+instance Readable (Sequence PGM) [Image S (Y' SRGB) Word16] where+  decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f instance Readable (Sequence PGM) [Image S (Y D65) Word8] where   decodeWithMetadataM f = fmap (first (fmap fromImageBaseModel)) . decodeWithMetadataM f instance Readable (Sequence PGM) [Image S (Y D65) Word16] where@@ -250,11 +247,11 @@   let m = ppmHeight ppmHeader       n = ppmWidth ppmHeader   case ppmData of-    PbmPixelData v      -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Bit)+    PbmPixelData v      -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Bit)                               fromNetpbmImageUnsafe m n v-    PgmPixelData8 v     -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word8)+    PgmPixelData8 v     -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word8)                               fromNetpbmImageUnsafe m n v-    PgmPixelData16 v    -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.Y Word16)+    PgmPixelData16 v    -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.X Word16)                               fromNetpbmImageUnsafe m n v     PpmPixelDataRGB8 v  -> do Refl <- eqT :: Maybe (Pixel cs e :~: Pixel CM.RGB Word8)                               fromNetpbmImageUnsafe m n v
tests/Test/Massiv/Array/IO/Image/AutoSpec.hs view
@@ -7,7 +7,7 @@ module Test.Massiv.Array.IO.Image.AutoSpec (spec) where  import Data.Massiv.Array-import Data.Massiv.Array.IO hiding (showsType)+import Data.Massiv.Array.IO import Test.Massiv.Core import Test.Massiv.Array.IO.Image.Common @@ -38,10 +38,10 @@      , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word16)      , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word32)      , Readable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word64)-     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word8)-     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word16)-     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word32)-     , Readable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word64)+     , Readable (Auto f) (Image S (Y'CbCr SRGB) Word8)+     , Readable (Auto f) (Image S (Y'CbCr SRGB) Word16)+     , Readable (Auto f) (Image S (Y'CbCr SRGB) Word32)+     , Readable (Auto f) (Image S (Y'CbCr SRGB) Word64)      -- (AdobeRGB 'NonLinear) doesn't have Luma instance      -- , Readable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word8)      -- , Readable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word16)@@ -79,10 +79,10 @@      , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word16)      , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word32)      , Writable (Auto f) (Image S (CMYK (AdobeRGB 'NonLinear)) Word64)-     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word8)-     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word16)-     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word32)-     , Writable (Auto f) (Image S (YCbCr (SRGB 'NonLinear)) Word64)+     , Writable (Auto f) (Image S (Y'CbCr SRGB) Word8)+     , Writable (Auto f) (Image S (Y'CbCr SRGB) Word16)+     , Writable (Auto f) (Image S (Y'CbCr SRGB) Word32)+     , Writable (Auto f) (Image S (Y'CbCr SRGB) Word64)      -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word8)      -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word16)      -- , Writable (Auto f) (Image S (YCbCr (AdobeRGB 'NonLinear)) Word32)@@ -132,10 +132,10 @@       specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word16 f       specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word32 f       specEncodeDecodeAutoNoError @(CMYK (SRGB 'NonLinear)) @Word64 f-      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word8 f-      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word16 f-      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word32 f-      specEncodeDecodeAutoNoError @(YCbCr (SRGB 'NonLinear)) @Word64 f+      specEncodeDecodeAutoNoError @(Y'CbCr SRGB) @Word8 f+      specEncodeDecodeAutoNoError @(Y'CbCr SRGB) @Word16 f+      specEncodeDecodeAutoNoError @(Y'CbCr SRGB) @Word32 f+      specEncodeDecodeAutoNoError @(Y'CbCr SRGB) @Word64 f       specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word8 f       specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word16 f       specEncodeDecodeAutoNoError @(AdobeRGB 'NonLinear) @Word32 f
tests/Test/Massiv/Array/IO/Image/Common.hs view
@@ -8,19 +8,18 @@  import Data.List.NonEmpty as NE (NonEmpty(..)) import Data.Massiv.Array-import Data.Massiv.Array.IO hiding (showsType)+import Data.Massiv.Array.IO import qualified Data.ByteString.Lazy as BL import Test.Massiv.Core import System.Random-import Test.Hspec.QuickCheck   elevatorGen :: (Random e, Elevator e) => Gen e elevatorGen = choose (minValue, maxValue) -instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel Y' e) where+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Y' SRGB) e) where   arbitrary = PixelY' <$> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha Y') e) where+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (Y' SRGB)) e) where   arbitrary = PixelY'A <$> elevatorGen <*> elevatorGen instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Y i) e) where   arbitrary = PixelY <$> elevatorGen@@ -34,10 +33,10 @@   arbitrary = PixelRGB <$> elevatorGen <*> elevatorGen <*> elevatorGen instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (AdobeRGB l)) e) where   arbitrary = PixelRGBA <$> elevatorGen <*> elevatorGen <*> elevatorGen <*> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (YCbCr cs) e) where-  arbitrary = PixelYCbCr <$> elevatorGen <*> elevatorGen <*> elevatorGen-instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (YCbCr cs)) e) where-  arbitrary = PixelYCbCrA <$> elevatorGen <*> elevatorGen <*> elevatorGen <*> elevatorGen+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Y'CbCr cs) e) where+  arbitrary = PixelY'CbCr <$> elevatorGen <*> elevatorGen <*> elevatorGen+instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (Y'CbCr cs)) e) where+  arbitrary = PixelY'CbCrA <$> elevatorGen <*> elevatorGen <*> elevatorGen <*> elevatorGen instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (CMYK cs) e) where   arbitrary = PixelCMYK <$> elevatorGen <*> elevatorGen <*> elevatorGen <*> elevatorGen instance (Arbitrary e, Random e, Elevator e) => Arbitrary (Pixel (Alpha (CMYK cs)) e) where
tests/Test/Massiv/Array/IO/Image/JuicyPixelsSpec.hs view
@@ -6,7 +6,7 @@ {-# LANGUAGE TypeApplications #-} module Test.Massiv.Array.IO.Image.JuicyPixelsSpec (spec) where -import Data.Massiv.Array.IO hiding (showsType)+import Data.Massiv.Array.IO import Test.Massiv.Core import Test.Massiv.Array.IO.Image.Common @@ -14,13 +14,13 @@ spec =   describe "Readable/Writable" $ do     describe "BMP" $ do-      specEncodeNoError @Y' @Word8 BMP+      specEncodeNoError @(Y' SRGB) @Word8 BMP       specEncodeNoError @(Y D65) @Word8 BMP       --specEncodeDecodeNoError @(Y D65) @Word8 BMP       specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 BMP       specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 BMP     describe "GIF" $ do-      specEncodeNoError @Y' @Word8 GIF+      specEncodeNoError @(Y' SRGB) @Word8 GIF       specEncodeNoError @(Y D65) @Word8 GIF       specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 GIF       --specEncodeGifSequenceNoError @(Y D65) @Word8@@ -32,17 +32,17 @@     -- describe "HDR" $ do     --   specEncodeDecodeNoError @(SRGB 'NonLinear) @Float HDR     describe "JPG" $ do-      specEncodeDecodeNoError @Y' @Word8 JPG+      specEncodeDecodeNoError @(Y' SRGB) @Word8 JPG       specEncodeDecodeNoError @(Y D65) @Word8 JPG       specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 JPG       specEncodeDecodeNoError @(CMYK (SRGB 'NonLinear)) @Word8 JPG-      specEncodeDecodeNoError @(YCbCr (SRGB 'NonLinear)) @Word8 JPG+      specEncodeDecodeNoError @(Y'CbCr SRGB) @Word8 JPG       -- TODO: read YA8     describe "PNG" $ do-      specEncodeDecodeNoError @Y' @Word8 PNG-      specEncodeDecodeNoError @Y' @Word16 PNG-      specEncodeDecodeNoError @(Alpha Y') @Word8 PNG-      specEncodeDecodeNoError @(Alpha Y') @Word16 PNG+      specEncodeDecodeNoError @(Y' SRGB) @Word8 PNG+      specEncodeDecodeNoError @(Y' SRGB) @Word16 PNG+      specEncodeDecodeNoError @(Alpha (Y' SRGB)) @Word8 PNG+      specEncodeDecodeNoError @(Alpha (Y' SRGB)) @Word16 PNG       specEncodeDecodeNoError @(Y D65) @Word8 PNG       specEncodeDecodeNoError @(Y D65) @Word16 PNG       specEncodeDecodeNoError @(Alpha (Y D65)) @Word8 PNG@@ -52,21 +52,21 @@       specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 PNG       specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word16 PNG     describe "TGA" $ do-      specEncodeDecodeNoError @Y' @Word8 TGA+      specEncodeDecodeNoError @(Y' SRGB) @Word8 TGA       specEncodeDecodeNoError @(Y D65) @Word8 TGA       specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 TGA       specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word8 TGA     describe "TIF" $ do-      specEncodeDecodeNoError @Y' @Word8 TIF-      specEncodeDecodeNoError @Y' @Word16 TIF-      specEncodeDecodeNoError @Y' @Word32 TIF-      specEncodeDecodeNoError @Y' @Float TIF+      specEncodeDecodeNoError @(Y' SRGB) @Word8 TIF+      specEncodeDecodeNoError @(Y' SRGB) @Word16 TIF+      specEncodeDecodeNoError @(Y' SRGB) @Word32 TIF+      specEncodeDecodeNoError @(Y' SRGB) @Float TIF       specEncodeDecodeNoError @(Y D65) @Word8 TIF       specEncodeDecodeNoError @(Y D65) @Word16 TIF       specEncodeDecodeNoError @(Y D65) @Word32 TIF       specEncodeDecodeNoError @(Y D65) @Float TIF-      specEncodeDecodeNoError @(Alpha Y') @Word8 TIF-      specEncodeDecodeNoError @(Alpha Y') @Word16 TIF+      specEncodeDecodeNoError @(Alpha (Y' SRGB)) @Word8 TIF+      specEncodeDecodeNoError @(Alpha (Y' SRGB)) @Word16 TIF       specEncodeDecodeNoError @(Alpha (Y D65)) @Word8 TIF       specEncodeDecodeNoError @(Alpha (Y D65)) @Word16 TIF       specEncodeDecodeNoError @(SRGB 'NonLinear) @Word8 TIF@@ -75,4 +75,4 @@       specEncodeDecodeNoError @(Alpha (SRGB 'NonLinear)) @Word16 TIF       specEncodeDecodeNoError @(CMYK (SRGB 'NonLinear)) @Word8 TIF       specEncodeDecodeNoError @(CMYK (SRGB 'NonLinear)) @Word16 TIF-      specEncodeNoError @(YCbCr (SRGB 'NonLinear)) @Word8 TIF+      specEncodeNoError @(Y'CbCr SRGB) @Word8 TIF