Open grenzverkehr opened 4 years ago
cc @rullzer @skjnldsv
Does imagick supports it?
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
I don't think that we will be able to fix this. cc @nextcloud/server-triage fo more input on this.
There are other PHP apps which don't have this bug, so I think it should be fixable :)
For example https://lycheeorg.github.io:
This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.
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?
This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions.
Is there any information missing here?
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.
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.
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: https://github.com/libgd/libgd/issues/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 ;)
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.
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: https://github.com/h2non/imaginary/issues/397 (though it looks abandoned, so I don't expect it to get fixed really, but we'll see)
This sounds like a feature request to me.
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 :(
Same here with my Pixel. Takes photos & videos in DCI-P3, Nextcloud doesn't show them correctly in the previews.
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.
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.