Bug 492236 - Flattened image won't export to Photoshop (Colorspace differences)
Summary: Flattened image won't export to Photoshop (Colorspace differences)
Status: RESOLVED FIXED
Alias: None
Product: krita
Classification: Applications
Component: Brush engines (show other bugs)
Version: 5.2.1
Platform: macOS (DMG) macOS
: NOR normal
Target Milestone: ---
Assignee: Halla Rempt
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-26 21:38 UTC by ken jacobsen
Modified: 2024-08-31 10:56 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
The file that won't export to Photoshop (2.69 MB, application/x-krita)
2024-08-26 21:38 UTC, ken jacobsen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description ken jacobsen 2024-08-26 21:38:52 UTC
Created attachment 172988 [details]
The file that won't export to Photoshop

***
If you're not sure this is actually a bug, instead post about it at https://discuss.kde.org

If you're reporting a crash, attach a backtrace with debug symbols; see https://community.kde.org/Guidelines_and_HOWTOs/Debugging/How_to_create_useful_crash_reports
***

SUMMARY
Other similar images will export to Photoshop but this one won't for some reason , whether the colorspace is "gray built-in" or "Grayscale/Alpha Dot Gain 20%"


STEPS TO REPRODUCE
1. File/Export
2. Photoshop image
3. Save

OBSERVED RESULT
'Error: cannot save this image as a Photoshop image... one or more layers with a color model that is different from the image."

EXPECTED RESULT


SOFTWARE/OS VERSIONS
Windows: 
macOS: 
(available in the Info Center app, or by running `kinfo` in a terminal window)
Linux/KDE Plasma: 
KDE Plasma Version: 
KDE Frameworks Version: 
Qt Version: 

ADDITIONAL INFORMATION
Comment 1 vanyossi 2024-08-26 22:45:08 UTC
I can confirm the bug in master with the file provided. I have not look deep enough yet, but manipulating the image and layers from the GUI does not fix the issue.
Comment 2 Freya Lupen 2024-08-26 22:51:23 UTC
There is a hidden layer in the file called "decorations-wrapper-layer" with a color profile of sRGB-elle-V2-srgbtrc.icc, which is caused by "Show Guides" being on. Turning off "Show Guides" lets the file export as PSD.
Comment 3 Halla Rempt 2024-08-27 07:48:10 UTC
Something like

diff --git a/libs/impex/ColorModelHomogenousCheck.h b/libs/impex/ColorModelHomogenousCheck.h
index 494791e538..7bdf576c1c 100644
--- a/libs/impex/ColorModelHomogenousCheck.h
+++ b/libs/impex/ColorModelHomogenousCheck.h
@@ -84,7 +84,7 @@ private:
     bool check(KisNode * node)
     {
         KisLayer *layer = dynamic_cast<KisLayer*>(node);
-        if (layer) {
+        if (layer && layer->name() != "decorations-wrapper-layer") {
 
             const KoColorSpace * cs = layer->colorSpace();
             if (cs->colorModelId() != m_colorModelID || cs->colorDepthId() != m_colorDepthID) {

Should prevent this warning from happening, but I wonder how many other layer visitors need the same thing.
Comment 4 Dmitry Kazakov 2024-08-27 08:22:18 UTC
Hi, Halla!

You should use `KisBaseNode::isFakeNode()` for skipping non-exportable nodes.
Comment 5 Halla Rempt 2024-08-27 08:55:39 UTC
Right! Will do.
Comment 6 Halla Rempt 2024-08-27 08:59:03 UTC
Git commit 02671ca7e0b77c2dc5d90f4b237f28b470557a72 by Halla Rempt.
Committed on 27/08/2024 at 08:57.
Pushed by rempt into branch 'krita/5.2'.

Check whether a layer is fake

The homogenous check should disregard fake nodes.

M  +1    -1    libs/impex/ColorModelHomogenousCheck.h

https://invent.kde.org/graphics/krita/-/commit/02671ca7e0b77c2dc5d90f4b237f28b470557a72
Comment 7 Halla Rempt 2024-08-31 10:56:58 UTC
Git commit 28a8d2d4d5a67c6e398511a7501bd1b8afc42b23 by Halla Rempt.
Committed on 31/08/2024 at 10:56.
Pushed by rempt into branch 'master'.

Check whether a layer is fake

The homogenous check should disregard fake nodes.
(cherry picked from commit 02671ca7e0b77c2dc5d90f4b237f28b470557a72)

M  +1    -1    libs/impex/ColorModelHomogenousCheck.h

https://invent.kde.org/graphics/krita/-/commit/28a8d2d4d5a67c6e398511a7501bd1b8afc42b23