You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, just wondering if you could tweak the code support the 2d context colorSpace attribute:
let canvas = document.getElementById("myCanvas");
let options = { colorSpace: "display-p3"};
const context = canvas.getContext("2d", options);
Currently, pica does not provide a way to set this attribute. Images without a sRGB profile are converted to sRGB (by default if no colorSpace attribute is specified). I believe setting the colorSpace attribute to "display-p3" (for images with this embedded profile) would preserve the color profile. It would also make sense for images with wider gamut profiles than "display-P3" (better than converting to sRGB).
Also, currently the color profile does not get added back by the image-blob-reduce wrapper, which makes sense if colors are converted to sRGB. However, if setting the colorSpace attribute to "display-p3", this ICC profile should be added to the saved image.
Hopefully this makes sense. I could modify the code myself but there are so many places where getContext is used, not sure if all of these need to be modified, and I'm not exactly sure how to add back the ICC profile.
The text was updated successfully, but these errors were encountered:
tomdav999
changed the title
Add options object support for canvas resize?
Support colorSpace attribute for canvas resize?
Dec 27, 2024
Hi, just wondering if you could tweak the code support the 2d context colorSpace attribute:
Currently, pica does not provide a way to set this attribute. Images without a sRGB profile are converted to sRGB (by default if no colorSpace attribute is specified). I believe setting the colorSpace attribute to "display-p3" (for images with this embedded profile) would preserve the color profile. It would also make sense for images with wider gamut profiles than "display-P3" (better than converting to sRGB).
Also, currently the color profile does not get added back by the image-blob-reduce wrapper, which makes sense if colors are converted to sRGB. However, if setting the colorSpace attribute to "display-p3", this ICC profile should be added to the saved image.
Hopefully this makes sense. I could modify the code myself but there are so many places where getContext is used, not sure if all of these need to be modified, and I'm not exactly sure how to add back the ICC profile.
The text was updated successfully, but these errors were encountered: