Reputation: 31
When ImageIO is used to read an image file, then writes the BufferedImage
(without any manipulation of the BufferedImage
objet) to another file, the file size of the written file is different as compared to the original file.
Does ImageIO reads the full contents (including any metadata, like Exif metadata) of the image file?
And if it does read the full contents, then does ImageIO writes out the image contents including any metadata?
Upvotes: 3
Views: 1424
Reputation: 421020
Many file formats (including for instance jpeg) can be correctly compressed in several different ways (even for the same quality settings). The decompression is deterministic while the compression may non-deterministic.
The fact that there is no unique right way of compressing an image implies that you can't expect ImageIO to produce a byte-equivalent result after loading / saving a file.
Upvotes: 4