Safe Haskell | Safe-Inferred |
---|
Read and interpret the exif file of a JPEG image with pure Haskell code.
This hexif library has similar functionality as the exif package (http://hackage.haskell.org/package/exif-3000.0.0/docs/Graphics-Exif.html), which calls the C-library libexif(http://libexif.sourceforge.net/).
The first example shows how to print out all supported exif information of a JPEG image.
processFile :: FilePath -> IO() processFile fn = do exif <- fromFile fn mapM_ print (allFields exif)
Example:
processFile "RS4748.JPG"
The next example prints out the value of a single tag:
singleTag :: FilePath -> ExifTag -> IO() singleTag fn tag = do exif <- fromFile fn print $ getTag exif tag
Example:
singleTag "RS4847.JPG" TagComponentsConfiguration
For more information about JPG and Exif, see
- data ExifField = ExifField ExifTag String
- data ExifTag
- = TagInteroperabilityIndex
- | TagInteroperabilityVersion
- | TagImageWidth
- | TagImageLength
- | TagBitsPerSample
- | TagCompression
- | TagPhotometricInterpretation
- | TagImageDescription
- | TagModel
- | TagMake
- | TagOrientation
- | TagSamplesPerPixel
- | TagTagUnknown Word16
- | TagXResolution
- | TagYResolution
- | TagResolutionUnit
- | TagSoftware
- | TagDateTime
- | TagArtist
- | TagHostComputer
- | TagWhitePoint
- | TagPrimaryChromaticities
- | TagJPEGInterchangeFormat
- | TagJPEGInterchangeFormatLength
- | TagYCbCrCoefficients
- | TagYCbCrPositioning
- | TagReferenceBlackWhite
- | TagRelatedImageWidth
- | TagRelatedImageLength
- | TagCopyright
- | TagExposureTime
- | TagFNumber
- | TagExposureProgram
- | TagISOSpeedRatings
- | TagSensitivityType
- | TagExifVersion
- | TagDateTimeOriginal
- | TagDateTimeDigitized
- | TagComponentsConfiguration
- | TagCompressedBitsPerPixel
- | TagShutterSpeedValue
- | TagApertureValue
- | TagBrightnessValue
- | TagExposureBiasValue
- | TagMaxApertureValue
- | TagSubjectDistance
- | TagMeteringMode
- | TagLightSource
- | TagFlash
- | TagFocalLength
- | TagMakerNote
- | TagUserComment
- | TagSubsecTime
- | TagSubSecTimeOriginal
- | TagSubSecTimeDigitized
- | TagXPTitle
- | TagXPAuthor
- | TagFlashPixVersion
- | TagColorSpace
- | TagPixelXDimension
- | TagPixelYDimension
- | TagFocalPlaneXResolution
- | TagFocalPlaneYResolution
- | TagFocalPlaneResolutionUnit
- | TagSensingMethod
- | TagFileSource
- | TagSceneType
- | TagCFAPattern
- | TagCustomRendered
- | TagExposureMode
- | TagWhiteBalance
- | TagDigitalZoomRatio
- | TagFocalLengthIn35mmFilm
- | TagSceneCaptureType
- | TagGainControl
- | TagContrast
- | TagSaturation
- | TagSharpness
- | TagSubjectDistanceRange
- | TagImageUniqueID
- | TagGamma
- | TagPrintImageMatching
- | TagPanasonicTitle1
- | TagPanasonicTitle2
- | TagPadding
- | TagOffsetSchemata
- | TagGPSVersionID
- | TagGPSLatitudeRef
- | TagGPSLatitude
- | TagGPSLongitudeRef
- | TagGPSLongitude
- | TagGPSAltitudeRef
- | TagGPSAltitude
- | TagGPSTimeStamp
- | TagGPSImgDirectionRef
- | TagGPSImgDirection
- | TagGPSMapDatum
- | TagGPSDestLatitudeRef
- | TagGPSDestLatitude
- | TagGPSDestLongitudeRef
- | TagGPSDestLongitude
- | TagGPSDateStamp
- | TagSubDirIFDMain
- | TagSubDirIFDExif
- | TagSubDirIFDGPS
- | TagSubDirIFDInterop
- allFields :: Exif -> [ExifField]
- getTag :: Exif -> ExifTag -> Maybe String
- allFieldsInclDebug :: Exif -> [ExifField]
- fromFile :: FilePath -> IO Exif
- fromExifFile :: FilePath -> IO Exif
- dumpExif :: FilePath -> IO ()
Documentation
Definiton of the resulting output
Definition of all the supported Exif tags
allFieldsInclDebug :: Exif -> [ExifField]Source
Return a list of all ExifFields including the debug tags. Do NOT use this function. It will be deleted later.
fromFile :: FilePath -> IO ExifSource
Return the exit data from a jpeg file. Use this function to initialize your exif value
fromExifFile :: FilePath -> IO ExifSource
Helper function to read exif data from a dumped exif file Do not use this function. It's mainly used for debugging