My use case is pretty simple which I think is shared with many other developers.
I would like to:
1. Load an image
2. Read EXIF Orientation details (If available)
3. Rotate (90, 180, 270) degrees
4. Resize and store images.
I tried going through the forums and then tried:
Sanselan: Reads EXIF, but not JPG images. Also, commons-imaging download links are all broken.
Java ImageIO/Graphics2D: Can rotate/re-size(not one liner, but is understandable) although as suggested you do lose quality when rotating.
*BUT does not read all JPG images (Throws CMMException for some jpg file)
The rest are either too old and not maintained anymore, have no documentation at all or I missed the 'good' one.
Can anyone suggest a library that supports these few 'simple' use cases?
*Using Sanselan to read EXIF is fine. Read/Rotate/Re-size (JPGs) is my main problem
Thumbnailator is a simple Java library which has no external dependencies which can (a) load an image, (b) read the Exif metadata and automatically rotate the image, (c) resize and (d) store the image in one single statement:
Thumbnails.of("path/to/image")
.size(320, 240)
.toFile("path/to/thumbnail");
The above will:
If one desires to perform additional rotations, a rotate method is also available.
Disclaimer: I am the maintainer of Thumbnailator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With