Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Color management support #22951

Open
grenzverkehr opened this issue Sep 18, 2020 · 18 comments
Open

Color management support #22951

grenzverkehr opened this issue Sep 18, 2020 · 18 comments
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: previews and thumbnails help wanted

Comments

@grenzverkehr
Copy link

ICC profiles of photos are ignored. If photos have an Adobe RGB profile, they are displayed too pale. All thumbnails are displayed incorrectly: in Files, Photos and Viewer. The thumbnails should have the same ICC profile as the original photos. Until now, the preview images lose their ICC profile.

Here is an example in Viewer. The first photo has an sRGB profile. For the second photo, the profile of the photo was converted to an Adobe RGB profile.

srgb
argb

Background: More and more cameras are recording with the Adobe RGB profile, which is significantly larger in terms of color gamut. If photos with an Adobe RGB profile are used in Nextcloud, they are displayed incorrectly.

@grenzverkehr grenzverkehr added 0. Needs triage Pending check for reproducibility or if it fits our roadmap bug labels Sep 18, 2020
@kesselb
Copy link
Contributor

kesselb commented Sep 18, 2020

cc @rullzer @skjnldsv

@skjnldsv
Copy link
Member

Does imagick supports it?

@lazka
Copy link

lazka commented Sep 28, 2020

Here are three small files which show the problem if someone wants to reproduce this. They should all look the same if handled correctly. Sadly this affects all images generated by my Canon DSLR, so all images I have look wrong when looked at via nextcloud.

nextcloud-color-profile-bug.zip

Screenshot from 2020-09-28 17-14-41
Screenshot from 2020-09-28 17-14-40
Screenshot from 2020-09-28 17-14-38

@szaimen
Copy link
Contributor

szaimen commented Jun 11, 2021

I don't think that we will be able to fix this.
cc @nextcloud/server-triage fo more input on this.

@lazka
Copy link

lazka commented Jun 11, 2021

There are other PHP apps which don't have this bug, so I think it should be fixable :)

For example https://lycheeorg.github.io:

image

@ghost

This comment was marked as outdated.

@ghost ghost added stale Ticket or PR with no recent activity and removed stale Ticket or PR with no recent activity labels Jul 11, 2021
@burnoutberni
Copy link

Thanks for the pointer, @lazka, I think this is the ImageMagick things going on in Lychee that make image profiles work: https://github.com/LycheeOrg/Lychee/blob/376f8c7c9c463816252319dcbdab2975d221ed8a/app/Image/ImagickHandler.php#L93-L110

So, @skjnldsv, this means ImageMagick does support this. Probably, this should be easy to integrate here too, but I've got no clue of the Nextcloud code base. Anybody who wants to give it a try?

@ghost

This comment was marked as resolved.

@ghost ghost added the stale Ticket or PR with no recent activity label Aug 16, 2021
@ghost ghost closed this as completed Aug 30, 2021
@lazka
Copy link

lazka commented Aug 30, 2021

Is there any information missing here?

@a-pushkin
Copy link

This results in noticeably ugly colors if image uses ProPhoto RGB color profile. As monitor and camera technology is improving, more people will be using color profiles such as this (non sRGB).

Color distortion is unpleasant enough to make nextcloud unusable as photo gallery for such photos.

@scharks
Copy link

scharks commented Jul 22, 2022

I would really love to have the colour profile issue addressed. As a photographer I am forced to deliver images in the sRGB colour space as those viewing non-sRGB images would think I have poorly edited the colours. Other services like Dropbox can manage colourspaces just fine, it would be good if this could be looked at.

@kesselb kesselb added 1. to develop Accepted and waiting to be taken care of and removed needs info stale Ticket or PR with no recent activity 0. Needs triage Pending check for reproducibility or if it fits our roadmap labels Jul 24, 2022
@kesselb
Copy link
Contributor

kesselb commented Jul 24, 2022

Thanks for the pointer, @lazka, I think this is the ImageMagick things going on in Lychee that make image profiles work: https://github.com/LycheeOrg/Lychee/blob/376f8c7c9c463816252319dcbdab2975d221ed8a/app/Image/ImagickHandler.php#L93-L110

So, @skjnldsv, this means ImageMagick does support this. Probably, this should be easy to integrate here too, but I've got no clue of the Nextcloud code base. Anybody who wants to give it a try?

Lychee uses ImageMagick to resize images.
Nextcloud uses GD to resize images.

Afaik it's not possible to tell GD to keep the ICC profile: libgd/libgd#136 / https://stackoverflow.com/questions/5773032/how-to-stop-gd2-from-washing-away-the-colors-upon-resizing-images

Option 1)

Use ImageMagick to generate the thumbnails. This should be opt-in as ImageMagick is not available by default and is often disabled for security reasons.

The current implementation is: https://github.com/nextcloud/server/blob/051518cd63cdbb9ff0a47deaacea65f6a0df0b06/lib/private/legacy/OC_Image.php

You need to copy the class and rewrite every function to do the same but use the ImageMagick functions. As GD is usually available it's probably fine to rewrite only some functions to use the ImageMagick code. In this case I would recommend to extend the original OC_Image implementation.

https://github.com/nextcloud/server/blob/051518cd63cdbb9ff0a47deaacea65f6a0df0b06/lib/private/Preview/Image.php is the provider to trigger the preview generation. I guess we need some switch here to use default (GD) or ImageMagick.

Option 2)

Since Nextcloud 24 it's possible to use https://github.com/h2non/imaginary to generate image previews: https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#previews

If you are lucky imaginary does not drop the ICC profile (and it's super fast). Try it ;)

@kesselb kesselb reopened this Jul 24, 2022
@lazka
Copy link

lazka commented Jul 25, 2022

Since Nextcloud 24 it's possible to use https://github.com/h2non/imaginary to generate image previews: https://docs.nextcloud.com/server/latest/admin_manual/installation/server_tuning.html#previews

hm, imaginary looks kinda abandoned, the docker image hasn't been updated in two years. I'll give it a try though, thanks for the tip.

@lazka
Copy link

lazka commented Jul 25, 2022

I've tried it now, but nextcloud passes stripmeta=true to imaginary which for some reason makes it drop the color profile without converting and results in the same broken previews. Without stripmeta it works as expected.

I've filed a bug: h2non/imaginary#397 (though it looks abandoned, so I don't expect it to get fixed really, but we'll see)

@szaimen
Copy link
Contributor

szaimen commented Jan 23, 2023

This sounds like a feature request to me.

@szaimen szaimen added enhancement 0. Needs triage Pending check for reproducibility or if it fits our roadmap and removed 1. to develop Accepted and waiting to be taken care of bug labels Jan 23, 2023
@dronnikovigor
Copy link

Hi!
Is there any chance to fix this in near future? Having dozens of photos from iPhone in DCI-P3 profile makes NC useless as photo management system :(

@TacoCake
Copy link

Same here with my Pixel. Takes photos & videos in DCI-P3, Nextcloud doesn't show them correctly in the previews.

@Pierric82
Copy link

Agree with this request! I edit my pictures on the computer and then put them in albums. The pictures are all in AdobeRGB and they look very pale in the thumbnails. Zooming in makes the color pop - although the clients usually keep only 2-3 pictures in memory and if I come back to a picture previously zoomed into, it may be pale again. Proper conversion of AdobeRGB pictures would be nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending check for reproducibility or if it fits our roadmap enhancement feature: previews and thumbnails help wanted
Projects
None yet
Development

No branches or pull requests