Background: I am writing a camera app for a messenger program. I cannot save the captured image to persistent disk at any time. The camera must support all orientations.
For anybody who might be interested, here is how to get the Orientation tag using the 2.3.1 interface from https://github.com/strangecargo/metadata-extractor
Metadata header;
try {
ByteArrayInputStream bais= new ByteArrayInputStream(data);
ExifReader reader = new ExifReader(bais);
header = reader.extract();
Directory dir = header.getDirectory(ExifDirectory.class);
if (dir.containsTag(ExifDirectory.TAG_ORIENTATION)) {
Log.v(TAG, "tag_orientation exists: " + dir.getInt(ExifDirectory.TAG_ORIENTATION));
}
else {
Log.v(TAG, "tag_orietation doesn't exist");
}
} catch (JpegProcessingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} catch (MetadataException e) {
e.printStackTrace();
}