Closed GoogleCodeExporter closed 9 years ago
Hi,
Thank you for reporting this issue, including a detailed description of the
problem.
Yes, I agree that the `Thumbnailator.createThumbnail(File, int, int)` method
not using the EXIF information would not be the expected behavior.
This should not be a very difficult issue to fix (I'll just redirect the
implementation of that method to use the `Thumbnails.of` code path) so it
shouldn't take too long to address this.
While I'm at it, I'll look into which methods in the `Thumbnailator` class is
actually useful, which methods should be deprecated in favor of the
`Thumbnails.of` interface.
(As a historic note, the `Thumbnailator` class actually existed before the
`Thumbnails.of` interface existed.)
I'm glad that you've found the library useful! :)
Original comment by coobird...@gmail.com
on 27 May 2013 at 4:17
I'm not sure if there is a reason for that, but EXIF data is ignored when using
BufferedImage as a source:
@Test
public void testExif() throws IOException { //run with Java 7
BufferedImage image = ImageIO.read(new File("/home/denisk/img/upload.jpg")); //image rotated according to EXIF
ByteArrayInputStream is = new ByteArrayInputStream(Files.readAllBytes(Paths.get("/home/denisk/img/upload.jpg")));
Thumbnails.of(image) //this produces not rotated image
.size(800, 600)
.outputFormat("jpg")
.toOutputStream(new FileOutputStream("/tmp/img-not_rotated.jpg"));
Thumbnails.of(is) //this produces rotated image
.size(800, 600)
.outputFormat("jpg")
.toOutputStream(new FileOutputStream("/tmp/img-rotated.jpg"));
}
This seems to happen because in
net.coobird.thumbnailator.tasks.io.BufferedImageSource#read method there is no
use of param.useExifOrientation() method. If there is a reason for that,
please comment.
Original comment by denis.k1...@gmail.com
on 10 Jun 2013 at 3:15
Hi,
The reason using `Thumbnails.of(BufferedImage)` does not perform a rotation
according to the Exif metadata is because the `BufferedImage` object does not
contain Exif metadata.
(The metadata is lost when using `ImageIO.read` to obtain the `BufferedImage`.)
On the other hand, using the `Thumbnails.of(InputStream)` does allow rotation
using Exif, because the `InputStream` is returning the byte stream of the JPEG
image which contains the Exif metadata.
So, the issue isn't that the Exif metadata is being ignored for the
`BufferedImage` case, it's just that the Exif metadata doesn't exist when
handling `BufferedImage`s.
------
Note: In the future, please create a new issue if the issue you're having does
not directly apply to the issue at hand -- this issue deals with the behavior
of the `Thumbnailator.createThumbnail` method.
Original comment by coobird...@gmail.com
on 11 Jun 2013 at 1:32
Original comment by coobird...@gmail.com
on 29 Jun 2013 at 6:57
This issue has been addressed in Thumbnailator 0.4.5.
Original comment by coobird...@gmail.com
on 30 Jun 2013 at 11:38
Original issue reported on code.google.com by
br...@fireplan.ca
on 19 May 2013 at 4:40