Issue 377 in webp: Physical aspect of image is lost

47 views
Skip to first unread message

julio.ve… via monorail

unread,
Mar 8, 2018, 9:15:05 PM3/8/18
to webp-d...@webmproject.org
Status: New
Owner: ----
Labels: Type-Defect Priority-Medium

New issue 377 by julio.ve...@crossknight.com.ar: Physical aspect of image is lost
https://bugs.chromium.org/p/webp/issues/detail?id=377

What steps will reproduce the problem?
1. Get an image with 300 dpi (PNG file with a pHYs chunk, or a JPG with Xdensity/Ydensity; for example, an image saved with Adobe Photoshop).
2. Use cwebp to convert the file to webp format.
3. Open the file with any viewer, like XnViewMP.


What is the expected output? What do you see instead?
The intended physical aspect should be known, either with a specific field in the WebP structure, or at least being able to tell cwebp to migrate the pHYs or X/Ydensity data into the EXIF XResolution / YResolution / ResolutionUnit fields.

Currently there's no easy way to know the original image physical aspect. Even if the EXIF data is copied (-metadata exif), usually that's not the intended physical resolution. E.g. cameras usually set the resolution to 72 dpi, so that will be the reported dpi even after resampling the image.


What version of the product are you using? On what operating system?
libwebp-0.6.1-rc2-windows-x64-no-wic.


Please provide any additional information below.


--
You received this message because:
1. The project was configured to send all issue notifications to this address

You may adjust your notification preferences at:
https://bugs.chromium.org/hosting/settings

jz… via monorail

unread,
Mar 30, 2018, 11:04:31 PM3/30/18
to webp-d...@webmproject.org
Updates:
Labels: -Type-Defect Needs-Feedback Type-Enhancement

Comment #1 on issue 377 by jz...@google.com: Physical aspect of image is lost
https://bugs.chromium.org/p/webp/issues/detail?id=377#c1

Thanks for the report. Do you have a sample image you can attach for reference? The webp format does allow arbitrary chunks to be added, but currently that would require a custom mux using libwebpmux for example.
The tools as they are treat the known chunks exif/xmp/iccp as opaque blobs, I don't think we'll get into direct modification of them.

julio.ve… via monorail

unread,
Mar 31, 2018, 1:11:06 PM3/31/18
to webp-d...@webmproject.org

Comment #2 on issue 377 by julio.ve...@crossknight.com.ar: Physical aspect of image is lost
https://bugs.chromium.org/p/webp/issues/detail?id=377#c2

I attached a JPG and PNG files with a print resolution of 150 DPI, as saved by GIMP. The PNG has the print resolution in a pHYs chunk, and the JPG in the JFIF data part.

In order to retain the intended resolution of an image, I had to write a Python script that reads the pHYs/JFIF data in the original image and creates (or extracts and modifies) the Exif information, calling webpmux to add the Exif to the converted webp image.

Attachments:
blueprint.jpg 34.4 KB
blueprint.png 124 KB
blueprint.webp 92.3 KB

julio.ve… via monorail

unread,
Mar 31, 2018, 1:25:46 PM3/31/18
to webp-d...@webmproject.org

Comment #3 on issue 377 by julio.ve...@crossknight.com.ar: Physical aspect of image is lost
https://bugs.chromium.org/p/webp/issues/detail?id=377#c3

As the dwebp tool does not export the Exif information (nor extract the resolution from it), if I want to edit the webp image in most image editors, I also have to use webpmux to extract the Exif, read the resolution, and write the pHYs and eXIf chunks to the converted PNG.

Those operations should be done automatically by dwebp in order to retain the original information.

s… via monorail

unread,
Sep 26, 2018, 2:42:35 AM9/26/18
to webp-d...@webmproject.org

Comment #4 on issue 377 by sk...@google.com: Physical aspect of image is lost
https://bugs.chromium.org/p/webp/issues/detail?id=377#c4


This issue seems more general than just the WebP format: any EXIF-bearing format would have the same problem when trying to recode into PNG.
The problem i see is that PNG also stores the EXIF metadata, so you end up with the same info written twice into the PNG. The EXIF blob needs to be edited to cut out the pHYs information and avoid this redundancy (and the potential desync).

Overall it seems like this metadata manipulation goes way past the perimeter of the core codec, and is solvable through scripts (fortunately). Any fix hardcoded directly into the codec (dwebp + cwebp + libmux) would be quite involved.

For the sake of future reference, could you post your script chain if possible? That may be useful for other users (and may end up in the doc or faq if needed).

Thanks!

pascal.m… via monorail

unread,
Jun 29, 2019, 3:49:18 AM6/29/19
to webp-d...@webmproject.org
Updates:
Status: WontFix

Comment #5 on issue 377 by pascal.m...@gmail.com: Physical aspect of image is lost
https://bugs.chromium.org/p/webp/issues/detail?id=377#c5

[closing as wontfix]
Reply all
Reply to author
Forward
0 new messages