use of com.drew.metadata.MetadataException in project react-native-camera by lwansbrough.
the class MutableImage method fixOrientation.
public void fixOrientation() throws ImageMutationFailedException {
try {
Metadata metadata = originalImageMetaData();
ExifIFD0Directory exifIFD0Directory = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
if (exifIFD0Directory == null) {
return;
} else if (exifIFD0Directory.containsTag(ExifIFD0Directory.TAG_ORIENTATION)) {
int exifOrientation = exifIFD0Directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
if (exifOrientation != 1) {
rotate(exifOrientation);
exifIFD0Directory.setInt(ExifIFD0Directory.TAG_ORIENTATION, 1);
}
}
} catch (ImageProcessingException | IOException | MetadataException e) {
throw new ImageMutationFailedException("failed to fix orientation", e);
}
}
use of com.drew.metadata.MetadataException in project tika by apache.
the class ImageMetadataExtractor method parseJpeg.
public void parseJpeg(File file) throws IOException, SAXException, TikaException {
try {
com.drew.metadata.Metadata jpegMetadata = JpegMetadataReader.readMetadata(file);
handle(jpegMetadata);
} catch (JpegProcessingException e) {
throw new TikaException("Can't read JPEG metadata", e);
} catch (MetadataException e) {
throw new TikaException("Can't read JPEG metadata", e);
}
}
use of com.drew.metadata.MetadataException in project tika by apache.
the class ImageMetadataExtractor method parseWebP.
public void parseWebP(File file) throws IOException, TikaException {
try {
com.drew.metadata.Metadata webPMetadata = new com.drew.metadata.Metadata();
webPMetadata = WebpMetadataReader.readMetadata(file);
handle(webPMetadata);
} catch (IOException e) {
throw e;
} catch (RiffProcessingException e) {
throw new TikaException("Can't process Riff data", e);
} catch (MetadataException e) {
throw new TikaException("Can't process Riff data", e);
}
}
use of com.drew.metadata.MetadataException in project react-native-camera by react-native-community.
the class MutableImage method fixOrientation.
public void fixOrientation() throws ImageMutationFailedException {
try {
Metadata metadata = originalImageMetaData();
ExifIFD0Directory exifIFD0Directory = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
if (exifIFD0Directory == null) {
return;
} else if (exifIFD0Directory.containsTag(ExifIFD0Directory.TAG_ORIENTATION)) {
int exifOrientation = exifIFD0Directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
if (exifOrientation != 1) {
rotate(exifOrientation);
exifIFD0Directory.setInt(ExifIFD0Directory.TAG_ORIENTATION, 1);
}
}
} catch (ImageProcessingException | IOException | MetadataException e) {
throw new ImageMutationFailedException("failed to fix orientation", e);
}
}
use of com.drew.metadata.MetadataException in project java-mapollage by trixon.
the class PhotoInfo method init.
public void init() throws ImageProcessingException, IOException {
try {
mMetadata = ImageMetadataReader.readMetadata(mFile);
mExifDirectory = mMetadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
mGpsDirectory = mMetadata.getFirstDirectoryOfType(GpsDirectory.class);
mGeoLocation = getGeoLocation();
try {
ExifIFD0Directory rotationDirectory = mMetadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
mOrientation = rotationDirectory.getInt(ExifSubIFDDirectory.TAG_ORIENTATION);
} catch (MetadataException | NullPointerException ex) {
mOrientation = 1;
}
} catch (IOException ex) {
throw new IOException(String.format("E000 %s", mFile.getAbsolutePath()));
}
}
Aggregations