Java Bean
Java Bean

Reputation: 434

Extracting EXIF info from ImageProxy

I'm trying to extract all the available EXIF data from ImageProxy object. I can get the rotation information using imageProxy.getImageInfo().getRotationDegrees()

But the TagBundle object seems to be empty

TagBundle tagBundle = imageProxy.getImageInfo().getTagBundle();
tagBundle.listKeys() -> empty

Any suggestions? Thanks!

Upvotes: 2

Views: 507

Answers (1)

erikreed
erikreed

Reputation: 1569

This approach is still a hassle if the goal is getting all the set EXIF tags, but this at least allows you to get them by tag name.

fun proxyToExif(proxy: ImageProxy): ExifInterface {
    val bb = proxy.planes[0].buffer
    val buffer = ByteArray(bb.remaining())
    bb.get(buffer)
    return ExifInterface(ByteArrayInputStream(buffer))
}

For example, to get the exposure time:

exif.getAttribute(ExifInterface.TAG_EXPOSURE_TIME)

All the set tags are defined internally but not exposed, which is unfortunate. List of set exif attribute keys

Upvotes: 1

Related Questions