https://bugs.kde.org/show_bug.cgi?id=428238
Bug ID: 428238 Summary: Not able to render PSD file with depth != 8 Product: frameworks-kimageformats Version: 5.75.0 Platform: Compiled Sources OS: All Status: REPORTED Severity: normal Priority: NOR Component: general Assignee: alex.me...@kde.org Reporter: wzc782970...@gmail.com CC: kdelibs-b...@kde.org Target Milestone: --- SUMMARY Current kimageformats PSD plugin is not able to render PSD image if the image depth is not 8. STEPS TO REPRODUCE 1. Find any PSD image which its bit depth is not 8 (mostly it will be 16, there is one example image found on my computer, which can be used for testing). 2. Make sure kimageformats is installed and try load that PSD image with Gwenview. 3. See the result. OBSERVED RESULT Image will not displayed correctly. EXPECTED RESULT Image can be rendered without problem. SOFTWARE/OS VERSIONS I build it manually so maybe the source revision is more useful. kimageformats git revision: db0b5d571a303e2f3c3e307a541193776e5c26b4 ADDITIONAL INFORMATION by looking at the source code we can know it doesn't support PSD image with depth != 8 : https://invent.kde.org/frameworks/kimageformats/-/blob/master/src/imageformats/psd.cpp#L90-92 if (header.depth != 8) { return false; } If we'd like to add additional support like depth == 16, then we probably need to deal with the case when channel size is not 1 (currently it will assume the channel size is always 1, since it only support the case when depth == 8). We could do something like: int channel_size = header.depth / 8; const quint32 pixel_count = header.height * header.width; const quint32 channel_data_length = pixel_count * channel_size; and we also need to change some other place to make it works. like the place when we calling decodeRLEData(), and the part for reading uncompressed image data. I don't have much experience about this so sorry I cannot make a working patch here :/ Krita can load the image correctly, maybe reuse the code from krita is also a good way to fix this issue. Probably related code: https://github.com/KDE/krita/blob/8d8dc773da21a0357fd4e33e14253d5b962e9ad0/plugins/impex/psd/psd_image_data.cpp#L53 https://github.com/KDE/krita/blob/4f9cc2c19d3a950e2b4c48d7c87af7c64cb64c59/plugins/impex/psd/psd_pixel_utils.cpp#L240-L243 -- You are receiving this mail because: You are watching all bug changes.