dragon66 / icafe

Java library for reading, writing, converting and manipulating images and metadata
Eclipse Public License 1.0
203 stars 58 forks source link

Inplace meta data update for JPG files #99

Closed lanthale closed 3 years ago

lanthale commented 3 years ago

I am using your lib for changing meta data in JPG files in my opensource app Photoslide github.com/lanthale/photoslide.

Actually I load the meta data in memory and change it but afterwards the only way I have found is saving a new file with the changed meta data. That means the file creation date will be updated.

Why is it not possible to manipulate the meta data without creating a new file so that the creation date will not be touched ?

dragon66 commented 3 years ago

@lanthale the main reason is to save memory. If you want to save to the same file, you have to read and process the image and put the image in memory before save it back to the original image. It is an override operation not append. This may not be a big issue unless the image is small.

Another reason is I don't want to change the original image and want to keep it intact after the change to the image.

If you want to do in-place change, you can do the same thing first write to ByteArrayOutputStream and in the end, save back to the original image file.

Wen