-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | EXIF handling library in pure Haskell
--   
--   The hsexif library provides functions for working with EXIF data
--   contained in JPEG files. Currently it only supports reading the data.
@package hsexif
@version 0.6.1.6


-- | Ability to work with the EXIF data contained in image files.
module Graphics.HsExif

-- | 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
--   reading of a directory tree.
parseFileExif :: FilePath -> IO (Either String (Map ExifTag ExifValue))

-- | Read EXIF data from a lazy bytestring.
parseExif :: ByteString -> Either String (Map ExifTag ExifValue)

-- | Decode an EXIF date time value. Will return <a>Nothing</a> in case
--   parsing fails.
readExifDateTime :: String -> Maybe LocalTime

-- | Extract the date and time when the picture was taken from the EXIF
--   information.
getDateTimeOriginal :: Map ExifTag ExifValue -> Maybe LocalTime

-- | Extract the image orientation from the EXIF information. Will return
--   <a>Nothing</a> on parse error.
getOrientation :: Map ExifTag ExifValue -> Maybe ImageOrientation
data ImageOrientation
Normal :: ImageOrientation
Mirror :: ImageOrientation
Rotation :: RotationDirection -> ImageOrientation
MirrorRotation :: RotationDirection -> ImageOrientation
data RotationDirection
MinusNinety :: RotationDirection
Ninety :: RotationDirection
HundredAndEighty :: RotationDirection

-- | Extract the GPS latitude and longitude where the picture was taken (if
--   it is present in the EXIF)
getGpsLatitudeLongitude :: Map ExifTag ExifValue -> Maybe (Double, Double)

-- | Will return Just True if the flash was fired, Just False if it was
--   not, and Nothing if the file does not contain the information.
wasFlashFired :: Map ExifTag ExifValue -> Maybe Bool

-- | Format the exif value as floating-point if it makes sense, otherwise
--   use the default <a>show</a> implementation. The first parameter lets
--   you specify how many digits after the comma to format in the result
--   string. The special behaviour applies only for <a>ExifRational</a> and
--   <a>ExifRationalList</a>.
formatAsFloatingPoint :: Int -> ExifValue -> String

-- | Extract the GPS date time, if present in the picture.
getGpsDateTime :: Map ExifTag ExifValue -> Maybe LocalTime

-- | read the GPS time from the <a>gpsTimeStamp</a> field.
parseGpsTime :: ExifValue -> Maybe TimeOfDay

-- | An exif value.
--   
--   If you want a string describing the contents of the value, simply use
--   <a>show</a>.
data ExifValue

-- | An exif number. Originally it could have been short, int, signed or
--   not.
ExifNumber :: !Int -> ExifValue

-- | ASCII text.
ExifText :: !String -> ExifValue

-- | 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) <a>show</a> will display it as
--   1/160.
ExifRational :: !Int -> !Int -> ExifValue

-- | List of numbers. Originally they could have been short, int, signed or
--   not.
ExifNumberList :: ![Int] -> ExifValue

-- | A list of rational numbers (numerator, denominator). Sometimes we're
--   used to it as rational (exposition time: 1/160), sometimes as float
--   (exposure compensation, we rather think -0.75) <a>show</a> will
--   display it as 1/160.
ExifRationalList :: ![(Int, Int)] -> ExifValue

-- | The undefined type in EXIF means that the contents are not specified
--   and up to the manufacturer. In effect it's exactly a bytestring.
--   Sometimes it's text with ASCII or UNICODE at the beginning, often it's
--   binary in nature.
ExifUndefined :: !ByteString -> ExifValue

-- | Unknown exif value type. All EXIF 2.3 types are supported, it could be
--   a newer file. The parameters are type, count then value
ExifUnknown :: !Word16 -> !Int -> !Int -> ExifValue
exposureTime :: ExifTag
fnumber :: ExifTag
isoSpeedRatings :: ExifTag
dateTimeOriginal :: ExifTag
shutterSpeedValue :: ExifTag
apertureValue :: ExifTag
brightnessValue :: ExifTag
exposureBiasValue :: ExifTag
maxApertureValue :: ExifTag
flash :: ExifTag
focalLength :: ExifTag
userComment :: ExifTag
orientation :: ExifTag
make :: ExifTag
model :: ExifTag
software :: ExifTag
copyright :: ExifTag
digitalZoomRatio :: ExifTag
focalLengthIn35mmFilm :: ExifTag
artist :: ExifTag
gpsVersionID :: ExifTag
gpsLatitudeRef :: ExifTag
gpsLatitude :: ExifTag
gpsLongitudeRef :: ExifTag
gpsLongitude :: ExifTag
gpsAltitudeRef :: ExifTag
gpsAltitude :: ExifTag
gpsTimeStamp :: ExifTag
gpsSatellites :: ExifTag
gpsStatus :: ExifTag
gpsMeasureMode :: ExifTag
gpsDop :: ExifTag
gpsSpeedRef :: ExifTag
gpsSpeed :: ExifTag
gpsTrackRef :: ExifTag
gpsTrack :: ExifTag
gpsImgDirectionRef :: ExifTag
gpsImgDirection :: ExifTag
gpsMapDatum :: ExifTag
gpsDestLatitudeRef :: ExifTag
gpsDestLatitude :: ExifTag
gpsDestLongitudeRef :: ExifTag
gpsDestLongitude :: ExifTag
gpsDestBearingRef :: ExifTag
gpsDestBearing :: ExifTag
gpsDestDistanceRef :: ExifTag
gpsDestDistance :: ExifTag
gpsProcessingMethod :: ExifTag
gpsAreaInformation :: ExifTag
gpsDateStamp :: ExifTag
gpsDifferential :: ExifTag
exifVersion :: ExifTag
sensingMethod :: ExifTag
fileSource :: ExifTag
sceneType :: ExifTag
makerNote :: ExifTag
subjectDistance :: ExifTag
meteringMode :: ExifTag
lightSource :: ExifTag
exifImageWidth :: ExifTag
exifImageHeight :: ExifTag
relatedSoundFile :: ExifTag
focalPlaneXResolution :: ExifTag
focalPlaneYResolution :: ExifTag
focalPlaneResolutionUnit :: ExifTag
dateTimeDigitized :: ExifTag
componentConfiguration :: ExifTag
compressedBitsPerPixel :: ExifTag
exposureProgram :: ExifTag
spectralSensitivity :: ExifTag
oecf :: ExifTag
subjectArea :: ExifTag
subSecTime :: ExifTag
subSecTimeOriginal :: ExifTag
subSecTimeDigitized :: ExifTag
flashPixVersion :: ExifTag
colorSpace :: ExifTag
flashEnergy :: ExifTag
spatialFrequencyResponse :: ExifTag
subjectLocation :: ExifTag
exposureIndex :: ExifTag
cfaPattern :: ExifTag
customRendered :: ExifTag
exposureMode :: ExifTag
whiteBalance :: ExifTag
sceneCaptureType :: ExifTag
gainControl :: ExifTag
contrast :: ExifTag
saturation :: ExifTag
sharpness :: ExifTag
deviceSettingDescription :: ExifTag
subjectDistanceRange :: ExifTag
imageUniqueId :: ExifTag
exifInteroperabilityOffset :: ExifTag
imageDescription :: ExifTag
xResolution :: ExifTag
yResolution :: ExifTag
resolutionUnit :: ExifTag
dateTime :: ExifTag
whitePoint :: ExifTag
primaryChromaticities :: ExifTag
yCbCrPositioning :: ExifTag
yCbCrCoefficients :: ExifTag
referenceBlackWhite :: ExifTag
exifIfdOffset :: ExifTag
printImageMatching :: ExifTag
gpsTagOffset :: ExifTag

-- | 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
--   <tt>exposureTime</tt> and so on.
data ExifTag
ExifTag :: TagLocation -> Maybe String -> Word16 -> ExifValue -> Text -> ExifTag

-- | In which part of the JPEG file the exif tag was found
[tagLocation] :: ExifTag -> TagLocation

-- | Description of the exif tag (exposureTime, fnumber...) or if unknown,
--   Nothing. This should be purely for debugging purposes, to compare tags
--   use == on ExifTag or compare the tagKey.
[tagDesc] :: ExifTag -> Maybe String

-- | Exif tag key, the number uniquely identifying this tag.
[tagKey] :: ExifTag -> Word16

-- | A function that'll display nicely an exif value for that exif tag. For
--   instance for the <tt>flash</tt> ExifTag, it'll say whether the flash
--   was fired or not, if there was return light and so on.
[prettyPrinter] :: ExifTag -> ExifValue -> Text

-- | 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 <tt>exposureTime</tt> and so on.
data TagLocation
ExifSubIFD :: TagLocation
IFD0 :: TagLocation
GpsSubIFD :: TagLocation
instance GHC.Classes.Eq Graphics.HsExif.ImageOrientation
instance GHC.Show.Show Graphics.HsExif.ImageOrientation
instance GHC.Classes.Eq Graphics.HsExif.RotationDirection
instance GHC.Show.Show Graphics.HsExif.RotationDirection
instance GHC.Show.Show Graphics.HsExif.IfEntry
instance GHC.Classes.Eq Graphics.HsExif.ByteAlign
