In an encrypted chat, preview images have to be created by the client. When my browser uploads an image to an encrypted chat, the resulting image preview is incorrect (it appears desaturated).
My understanding of the problem: Currently preview creation is done by sticking the image data into a canvas, then snapshotting the data, before uploading it. This approach is broken on correctly color managed computers, because the data on the canvas will represent the output of the browser's color management process, not the image's original colors. You need to either create the preview image in Javascript without touching the DOM, or use some trickery to prevent the browser from applying color corrections to the canvas, if that's possible. (Since the canvas is off screen, this might turn out to be a browser bug, but that's not my area of expertise.)
Technically this bug is in matrix-react-sdk, but I was asked to file it here instead.
Steps to reproduce
Upload any image to Riot.im from a color-managed browser to an encrypted chat.
Note that the colors in the preview image are incorrect, and different from the full image when you download them to compare. (The preview is also wrong on other devices.)
Obviously, the preview image should accurately represent the full image, especially since for many images, it's unlikely anyone will ever click to view the full thing.
Logs being sent: yes
(Logs are almost certainly not relevant here, but I'll send them. It would be nice to have some reassurance from the GUI that the logs I'm sending aren't personally identifiable or contain other private information.)
Original image (created in GIMP, color bars are #ff0000, #00ff00, #0000ff) vs. image preview, downloaded from Riot.im:
Version information
Platform: web
Browser: Firefox 69.0.1 (color management enabled for all images, with an ICM profile specified)
Description
See https://github.com/matrix-org/synapse/issues/6021 for some prior discussion.
In an encrypted chat, preview images have to be created by the client. When my browser uploads an image to an encrypted chat, the resulting image preview is incorrect (it appears desaturated).
My understanding of the problem: Currently preview creation is done by sticking the image data into a
canvas
, then snapshotting the data, before uploading it. This approach is broken on correctly color managed computers, because the data on the canvas will represent the output of the browser's color management process, not the image's original colors. You need to either create the preview image in Javascript without touching the DOM, or use some trickery to prevent the browser from applying color corrections to the canvas, if that's possible. (Since the canvas is off screen, this might turn out to be a browser bug, but that's not my area of expertise.)Technically this bug is in matrix-react-sdk, but I was asked to file it here instead.
Steps to reproduce
Obviously, the preview image should accurately represent the full image, especially since for many images, it's unlikely anyone will ever click to view the full thing.
Logs being sent: yes
(Logs are almost certainly not relevant here, but I'll send them. It would be nice to have some reassurance from the GUI that the logs I'm sending aren't personally identifiable or contain other private information.)
Original image (created in GIMP, color bars are
#ff0000
,#00ff00
,#0000ff
) vs. image preview, downloaded from Riot.im:Version information