https://bugs.kde.org/show_bug.cgi?id=468609

Dan <dkb...@tofubar.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkb...@tofubar.com

--- Comment #2 from Dan <dkb...@tofubar.com> ---
My canon HEIF images appear washed out and I thought this might be the solution
but am now convinced otherwise. I'm now slowly going down the education path on
colour profiles. I think this patch fixes the bit depth problem as a start. It
works for my canon images but I haven't tested for the full combination of
alpha and bit depth. 

diff --git a/core/dplugins/dimg/heif/dimgheifloader_load.cpp
b/core/dplugins/dimg/heif/dimgheifloader_load.cpp
index eb8862c91f..f3d0bdc071 100644
--- a/core/dplugins/dimg/heif/dimgheifloader_load.cpp
+++ b/core/dplugins/dimg/heif/dimgheifloader_load.cpp
@@ -335,7 +335,7 @@ bool DImgHEIFLoader::readHEICImageByHandle(struct
heif_image_handle* image_handl
 {
     int lumaBits   = heif_image_handle_get_luma_bits_per_pixel(image_handle);
     int chromaBits =
heif_image_handle_get_chroma_bits_per_pixel(image_handle);
-
+    int colorDepth = lumaBits;
     if ((lumaBits == -1) || (chromaBits == -1))
     {
         qCWarning(DIGIKAM_DIMG_LOG_HEIF) << "HEIC luma or chroma bits
information not valid!";
@@ -352,8 +352,8 @@ bool DImgHEIFLoader::readHEICImageByHandle(struct
heif_image_handle* image_handl
     struct heif_decoding_options* const decode_options =
heif_decoding_options_alloc();
     decode_options->ignore_transformations             = 1;
     m_hasAlpha                                         =
heif_image_handle_has_alpha_channel(image_handle);
-    heif_chroma chroma                                 = m_hasAlpha ?
heif_chroma_interleaved_RGBA
-                                                                    :
heif_chroma_interleaved_RGB;
+    heif_chroma chroma                                 = m_hasAlpha ?
((colorDepth==8) ? heif_chroma_interleaved_RGBA :
heif_chroma_interleaved_RRGGBBAA_LE)
+                                                                    :
((colorDepth==8) ? heif_chroma_interleaved_RGB :
heif_chroma_interleaved_RRGGBB_LE );

     // Trace to check image size properties before decoding, as these values
can be different.

@@ -385,8 +385,6 @@ bool DImgHEIFLoader::readHEICImageByHandle(struct
heif_image_handle* image_handl
     }

     heif_decoding_options_free(decode_options);
-
-    int colorDepth = heif_image_get_bits_per_pixel_range(heif_image,
heif_channel_interleaved);
     imageWidth()   = heif_image_get_width(heif_image,
heif_channel_interleaved);
     imageHeight()  = heif_image_get_height(heif_image,
heif_channel_interleaved);

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to