yoga icon indicating copy to clipboard operation
yoga copied to clipboard

Keep metadata when optimizing same format

Open shlagevuk opened this issue 11 months ago • 1 comments

Summary

As a user I want to be able to keep Exif/XMP/IPTC or other metadata when optimizing an image, so that metadata affecting image rendering are kept.

Why

As we've discussed on discord I've found that when optimizing a file, yoga strip it from metadata. It result in a change of color of resulting image, weither when optimizing to webp or jpg.

Example file

Below are source file in JPG, and webp image in a zip (github is not compatible with webp upload) img_webp.zip

img_brute_photoshop.jpg

Raw image from a photoshop export, lot of EXIF metadata img_brute_photoshop

img_export_gimp_no_exif.webp

Converted image using Gimp, there is still metadata as seen with this extract:

+-- img_export_gimp_no_exif.webp
    +-- RIFF [size: 16697518, formtype: WEBP]
        +-- VP8X [offset: 20, size: 10]
            +-- has_icc: 1
            +-- has_alpha: 0
            +-- has_exif: 1
            +-- has_xmp: 0
            +-- has_anim: 0
            +-- canvas_width: 4252
            +-- canvas_height: 2835
        +-- ICCP [offset: 38, size: 532]
        +-- VP8L [offset: 578, size: 16696926]
        +-- EXIF [offset: 16697512, size: 14]

img_optimized_noresized.webp

Optimised image without resizing, with a loss of color, no metadata.

img_optimized_resized.webp

Optimised image with resizing, same loss of color, no metadata.

shlagevuk avatar Jul 19 '23 17:07 shlagevuk

linked to https://github.com/wanadev/yoga/issues/36

shlagevuk avatar Jul 19 '23 17:07 shlagevuk