module Hakyll.Images.Metadata
( module Codec.Picture.Metadata,
imageMetadata,
metadata,
)
where
import Codec.Picture (decodeImageWithMetadata)
import Codec.Picture.Metadata
import Hakyll.Core.Compiler (Compiler)
import Hakyll.Core.Item (Item, itemBody)
import Hakyll.Images.Common (Image (..))
metadata :: Image -> Metadatas
metadata :: Image -> Metadatas
metadata Image
im = forall a c b. (a -> c) -> (b -> c) -> Either a b -> c
either forall a. HasCallStack => [Char] -> a
error forall a b. (a, b) -> b
snd (ByteString -> Either [Char] (DynamicImage, Metadatas)
decodeImageWithMetadata (Image -> ByteString
image Image
im))
imageMetadata :: Item Image -> Compiler Metadatas
imageMetadata :: Item Image -> Compiler Metadatas
imageMetadata = forall (m :: * -> *) a. Monad m => a -> m a
return forall b c a. (b -> c) -> (a -> b) -> a -> c
. Image -> Metadatas
metadata forall b c a. (b -> c) -> (a -> b) -> a -> c
. forall a. Item a -> a
itemBody