coobird / thumbnailator

Thumbnailator - a thumbnail generation library for Java
MIT License
5.14k stars 784 forks source link

Thumbnailator does not automatically rotate pictures from Samsung Galaxy S5 telephones #124

Closed ReedElliott closed 4 years ago

ReedElliott commented 6 years ago

Expected behavior

The following code should rotate the source file based on the Exif Orientation and save in the destination file.

Thumbnails.of(source).scale(1.0).toFile(destination);

Actual behavior

Destination file is not rotated.

Note: When I send my code pictures produced on other devices, the pictures are rotated properly.

I believe the following line in the getExifOrientation(..) method of the ExifUtils.java class throws an error when dealing with images from the Samsung Galaxy S5.

IIOMetadata metadata = reader.getImageMetadata(imageIndex);

Error: JFIF APP0 must be first marker after SOI

Steps to reproduce the behavior

Take a picture with Samsung Galaxy S5 and then run the above command on the file.

Environment

coobird commented 6 years ago

Note: Sounds similar to #108

coobird commented 4 years ago

I'll close this as a duplicate of #108.