nibasya / MozjpegGUI

HomePage
14 stars 2 forks source link

Copy metadata when converting images #3

Open davidbejarcaceres opened 9 months ago

davidbejarcaceres commented 9 months ago

Hi,

I´m trying to convert using this programm, but the the metadata is completly lost, is there a plan to update this app?

Thanks.

nibasya commented 9 months ago

I think I can try.

nibasya commented 6 months ago

At least jpeg seems to be keeping all metadata, but not for png and gif (though I failed to find an example of pngs and gifs which have valuable metadata). Any example for input file, or an information of input filetype? Did the loss happen in jpeg format?

davidbejarcaceres commented 6 months ago

At least jpeg seems to be keeping all metadata, but not for png and gif (though I failed to find an example of pngs and gifs which have valuable metadata). Any example for input file, or an information of input filetype? Did the loss happen in jpeg format?

One example is the output of AI generated images with Stable Diffusion, you can use this online tool to check the metadata like in the follwing screenshot:

PNG metadata extrated:

image

Original image (PNG with metadata):

original AI with metadata

Converted jpg (metadata lost):

mozjpeg converted no metadata

nibasya commented 5 months ago

Thanks for the info and the example. Let me check if exiftools ( https://exiftool.org/ ) which is used internally in https://exifmeta.com/ can help us.

nibasya commented 5 months ago

Sorry, seems to be impossible to copy the metadata of provided PNG example into JPG due to the difference of PNG and JPEG specification. The PNG can have any-kind of text tags; such as "prompt" (by using tEXt or similar chunks). But, JPEG cannot. Possible option will be copying the text tags into comment segment of JPEG; like:

{copy of comments from PNG} prompt: {"4": {"inputs": {"ckpt_name": **SNIP** "class_type": "LoraLoader"}} workflow: {"last_node_id": 63, **SNIP** "components": {}}

Note: due to JPEG specification limitation, total size of comments cannot exceed 64k bytes

Will this be better for you?