Skip to content

Scala library to parse JPEG Exif tags.

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING
Notifications You must be signed in to change notification settings

sven42/slibexif

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

slibexif

Build Status

Scala library to read JPEG Exif data. The library has no dependencies on any other libraries including javax.imageio.*.

Examples

Read GPS attributes:

  for {
    exif <- JpegMetaData(args("image.jpg")).exif
    lat <- exif.value(GpsIfd.GPSLatitude)
    lng <- exif.value(GpsIfd.GPSLongitude)
  } yield println(s"${tos(lat)}, ${tos(lng)}")


  def tos(r: List[Rational]): String = {
    val List(deg, min, sec) = r
    s"""${deg.toDouble}°${min.toDouble}'${sec.toDouble}\""""
  }

Prints something like 48.0°9.0'47.12, 11.0°35.0'49.931.

List all attributes of an image:

    JpegMetaData("image.jpg").exif.foreach(_.ifds.flatMap(_.attributes).foreach(
      attr => println(s"${attr.tag.name}: ${attr.value}")))

Prints

Make: Samsung
Model: Galaxy Nexus
Orientation: 1
XResolution: 72/1
YResolution: 72/1
ResolutionUnit: 2
DateTime: 2013:01:29 22:31:15
YCbCrPositioning: 1
ExifIfdPointer: 192
GpsInfoIfdPointer: 860
ImageWidth: 160
ImageLength: 120
Compression: 6
XResolution: 72/1
YResolution: 72/1
ResolutionUnit: 2
JPEGInterchangeFormat: 1284
JPEGInterchangeFormatLength: 3482
ExposureTime: 862/1000000
...

Using slibexif

slibexif for Scala 2.10 and 2.11 is available on the Maven Central repository, just add libraryDependencies += "net.n12n.exif" %% "slibexif" % "0.3.1" to your build.

Check the slibexif API scaladocs for more details.

About

Scala library to parse JPEG Exif tags.

Resources

License

LGPL-3.0, GPL-3.0 licenses found

Licenses found

LGPL-3.0
COPYING.LESSER
GPL-3.0
COPYING

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Scala 100.0%