Safe Haskell | None |
---|
Ability to work with the EXIF data contained in JPEG files.
- parseFileExif :: FilePath -> IO (Either String (Map ExifTag ExifValue))
- parseExif :: ByteString -> Either String (Map ExifTag ExifValue)
- readExifDateTime :: String -> Maybe LocalTime
- getDateTimeOriginal :: Map ExifTag ExifValue -> Maybe LocalTime
- getOrientation :: Map ExifTag ExifValue -> Maybe ImageOrientation
- data ImageOrientation
- data RotationDirection
- data ExifValue
- = ExifNumber Int
- | ExifText !String
- | ExifRational !Int !Int
- | ExifUnknown !Word16 !Int
- exposureTime :: ExifTag
- fnumber :: ExifTag
- exposureProgram :: ExifTag
- isoSpeedRatings :: ExifTag
- exifVersion :: ExifTag
- dateTimeOriginal :: ExifTag
- dateTimeDigitized :: ExifTag
- componentConfiguration :: ExifTag
- compressedBitsPerPixel :: ExifTag
- shutterSpeedValue :: ExifTag
- apertureValue :: ExifTag
- brightnessValue :: ExifTag
- exposureBiasValue :: ExifTag
- maxApertureValue :: ExifTag
- subjectDistance :: ExifTag
- meteringMode :: ExifTag
- lightSource :: ExifTag
- flash :: ExifTag
- focalLength :: ExifTag
- makerNote :: ExifTag
- userComment :: ExifTag
- colorSpace :: ExifTag
- exifImageWidth :: ExifTag
- exifImageHeight :: ExifTag
- relatedSoundFile :: ExifTag
- focalPlaneXResolution :: ExifTag
- focalPlaneYResolution :: ExifTag
- focalPlaneResolutionUnit :: ExifTag
- sensingMethod :: ExifTag
- fileSource :: ExifTag
- sceneType :: ExifTag
- orientation :: ExifTag
- make :: ExifTag
- model :: ExifTag
- software :: ExifTag
- copyright :: ExifTag
- data ExifTag = ExifTag {
- tagLocation :: TagLocation
- tagDesc :: Maybe String
- tagKey :: Word16
- data TagLocation
- = ExifSubIFD
- | IFD0
Documentation
EXIF parsing from JPEG files.
EXIF tags are enumerated as ExifTag values, check exposureTime
for instance.
If you use the predefined ExifTag values, you don't care about details
of the ExifTag type, however you should check out the ExifValue
type.
You start from a JPEG file, you can parse its exif tags as a Map
of
ExifTag
to ExifValue
using parseExif
or parseFileExif
.
You can enumerate the map or lookup
the tags that interest you.
There are also a couple of higher-level helpers like getOrientation
,
getDateTimeOriginal
.
Main functions
parseFileExif :: FilePath -> IO (Either String (Map ExifTag ExifValue))Source
Read EXIF data from the file you give. It's a key-value map.
parseExif :: ByteString -> Either String (Map ExifTag ExifValue)Source
Read EXIF data from a lazy bytestring.
Higher-level helper functions
readExifDateTime :: String -> Maybe LocalTimeSource
Decode an EXIF date time value.
Will return Nothing
in case parsing fails.
getDateTimeOriginal :: Map ExifTag ExifValue -> Maybe LocalTimeSource
Extract the date and time when the picture was taken from the EXIF information.
getOrientation :: Map ExifTag ExifValue -> Maybe ImageOrientationSource
Extract the image orientation from the EXIF information.
Will return Nothing
on parse error.
data ImageOrientation Source
data RotationDirection Source
The ExifValue type
An exif value. Exif values can also be float, but this library doesn't support it yet. If you have JPG files containing float exif values, please send it!
If you want a string describing the contents
of the value, simply use show
.
ExifNumber Int | An exif number. Could be short, int, signed or not. |
ExifText !String | ASCII text. |
ExifRational !Int !Int | A rational number (numerator, denominator).
Sometimes we're used to it as rational (exposition time: 1/160),
sometimes as float (exposure compensation, we rather think -0.75)
|
ExifUnknown !Word16 !Int | Unknown exif value type. Maybe float? If the JPEG file is not corrupted, please send it to me. |
All known exif tags
If you need to declare your own exif tags
An exif tag. Normally you don't need to fiddle with this,
except maybe if the library doesn't know the particular
exif tag you're interested in.
Rather check the list of supported exif tags, like
exposureTime
and so on.
ExifTag | |
|
data TagLocation Source
Location of the tag in the JPG file structure.
Normally you don't need to fiddle with this,
except maybe if the library doesn't know the particular
exif tag you're interested in.
Rather check the list of supported exif tags, like
exposureTime
and so on.