Closed GoogleCodeExporter closed 9 years ago
Thank you for the suggesting a new feature.
However, it is not within the scope of the Thumbnailator library to provide
information about the original image.
As the objective of the Thumbnailator library is to create a thumbnail from the
original image, using Thumbnailator without calling `size` or `scale` is not
valid, hence the exception is thrown.
Therefore, I will not be adding a new feature to Thumbnailator to obtain
information about the original image at this time.
-----
Just as an additional note about obtaining the width and height of the original
image.
One way is to simply use the `ImageIO.read` method to obtain the
`BufferedImage` representation of the image:
BufferedImage img = ImageIO.read(new File(img));
int width = img.getWidth();
int height = img.getHeight();
This will read the entire image to memory, so it could be wasteful when all
that is needed is the metadata like width and height.
There are other ways that don't require reading the entire image to memory,
illustrated here:
http://stackoverflow.com/questions/672916/how-to-get-image-height-and-width-usin
g-java
Original comment by coobird...@gmail.com
on 8 Oct 2012 at 6:00
Original issue reported on code.google.com by
x4j...@gmail.com
on 1 Oct 2012 at 11:27