packages feed

hsexif 0.6.1.4 → 0.6.1.5

raw patch · 3 files changed

+23/−3 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Graphics/HsExif.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE LambdaCase #-}+{-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-missing-signatures #-} -- | Ability to work with the EXIF data contained in image files. module Graphics.HsExif (@@ -172,6 +173,7 @@ -- and http://www.cipa.jp/std/documents/e/DC-008-2012_E.pdf -- and http://www.awaresystems.be/imaging/tiff/tifftags/privateifd/exif.html -- and http://www.exiv2.org/tags.html+-- and https://libopenraw.freedesktop.org/wiki/Fuji_RAF/  -- | Read EXIF data from the file you give. It's a key-value map. -- The reading is strict to avoid file handle exhaustion on a recursive@@ -194,7 +196,9 @@         -- own version number instead of 42.         (0x4949,0x524F) -> findAndParseExifBlockTiff  -- Olympus ORF         (0x4949,0x5500) -> findAndParseExifBlockTiff  -- Panasonic RW2-        _           -> fail "Not a JPEG, TIFF, or TIFF-based raw file"+        -- Fuji RAF files use a custom format with an embedded JPEG preview containing the EXIF data+        (0x4655,0x4A49) -> findAndParseExifBlockFuji  -- Fuji RAF+        _           -> fail "Not a JPEG, TIFF, RAF, or TIFF-based raw file"  findAndParseExifBlockJPEG :: Get (Map ExifTag ExifValue) findAndParseExifBlockJPEG = do@@ -209,6 +213,22 @@  findAndParseExifBlockTiff :: Get (Map ExifTag ExifValue) findAndParseExifBlockTiff = parseTiff++findAndParseExifBlockFuji :: Get (Map ExifTag ExifValue)+findAndParseExifBlockFuji = do+    header <- getByteString 16+    version <- getByteString 4+    skip 64+    jpegOffset <- getWord32be+    unless (header == "FUJIFILMCCD-RAW " && version == "0201") $ fail "Incorrect RAF header"+    skip $+      fromIntegral jpegOffset  -- skip to jpeg data (offset is from start of file)+      - 16                     -- 16 bytes for header+      - 4                      -- 4 bytes for version+      - 64                     -- 64 other bytes skiped+      - 4                      -- 4 bytes jpeg offset+      + 2                      -- findAndParseExifBlockJPEG expects 2 bytes skipped+    findAndParseExifBlockJPEG  data ByteAlign = Intel | Motorola deriving (Eq) 
hsexif.cabal view
@@ -1,5 +1,5 @@ name:                hsexif-version:             0.6.1.4+version:             0.6.1.5 synopsis:            EXIF handling library in pure Haskell description:         The hsexif library provides functions for working with EXIF data                      contained in JPEG files. Currently it only supports reading the data.
tests/Tests.hs view
@@ -57,7 +57,7 @@  testNotAJpeg :: B.ByteString -> Spec testNotAJpeg imageContents = it "returns empty list if not a JPEG" $-    assertEqual' (Left "Not a JPEG, TIFF, or TIFF-based raw file") (parseExif imageContents)+    assertEqual' (Left "Not a JPEG, TIFF, RAF, or TIFF-based raw file") (parseExif imageContents)  testNoExif :: B.ByteString -> Spec testNoExif imageContents = it "returns empty list if no EXIF" $