Bug 334582 - Krita psd exporter- exported file crashes blender, comes with no colorspace
Summary: Krita psd exporter- exported file crashes blender, comes with no colorspace
Alias: None
Product: krita
Classification: Unclassified
Component: File formats (show other bugs)
Version: 2.8.1
Platform: Archlinux Packages Linux
: NOR normal
Target Milestone: ---
Assignee: Krita Bugs
URL: https://developer.blender.org/T40107
Depends on:
Reported: 2014-05-10 14:37 UTC by Theodore Imre
Modified: 2015-08-08 07:39 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In:

photoshop cs2 shows our elle profile (32.67 KB, image/png)
2015-05-27 12:33 UTC, Halla Rempt
new test (143.18 KB, image/vnd.adobe.photoshop)
2015-05-27 12:37 UTC, Paul Geraskin
openimageio's iv after loading the psd file (66.68 KB, image/png)
2015-08-08 07:29 UTC, Halla Rempt

Note You need to log in before you can comment on or make changes to this bug.
Description Theodore Imre 2014-05-10 14:37:06 UTC
read more about the problem here

Reproducible: Always

Steps to Reproduce:
1. save a psd file in krita
2. open it in blender or gimp or any other software

Actual Results:  
 the file will have no color space

Expected Results:  
 the file should have color space
Comment 1 Dalai Felinto 2014-05-10 14:40:39 UTC
The file doesn't crash Blender anymore, but it is still something worthy looking at. OpenImageIO is returning a blank colorspace from that file (which was what caused the crash in the first place).

I suspect (didn't inspect it from the insides of OIIO yet) that the colorspace from Krita is mangled, and that's why OIIO discards it. In the original Blender report you can also see that the file in GIMP presents some issues as well:

"get a warning message about an embeded color profile (invalid- utf8 string). It asks me if I want to convert it to rgb working space."
Comment 2 Halla Rempt 2014-06-20 13:03:34 UTC
Can you attach one of those files? I cannot reproduce the issue in Gimp or Photoshop (and I don't know how to open an image file in Blender).
Comment 3 Dalai Felinto 2014-06-21 17:01:01 UTC
The .psd can be downloaded directly from the blender tracker (https://developer.blender.org/T40107) the .xcf will have to wait for Theodore Imre.

As to open images in Blender you open Blender, switch one of its editors to an UV/Image Editor, and there you open the image.
Comment 4 wolthera 2015-05-12 11:21:01 UTC
Blurymind, could you upload the XCF file in question?
Comment 5 Theodore Imre 2015-05-12 16:07:24 UTC
It is a PSD file, not an xcf one!

it no longer crashes blender, but it imports with the wrong colors. See my post at the b3d bugtracker.
Comment 6 wolthera 2015-05-12 17:07:17 UTC
I can confirm it opens weird in blender, even if I convert it to a recent colour space, or convert it to 16bit.

Either of the following could be happening:
1. Krita is embedding icc profiles incorrectly. As far as I can tell with a hex editor, the icc profile shows up fine in both psd as jpeg.
2. Krita isn't embedding icc profiles like it should according to the PSD spec, and photoshop doesn't give any warning and just converts it to sRGB.
3. Open Image IO doesn't support reading iccs as we save them, and this is one of those cases where PSD can do something in two completely different ways.

If I convert Blurymind's file to srgb-elle-v2-srgbtrc.icc(the new default), gimp will kindly ask if I would like to stay in that icc or convert to sRGB built-in.
Comment 7 wolthera 2015-05-12 17:15:01 UTC
If my hunch is correct, Krita isn't embedding the icc profiles in a adobe approved way, and Photoshop is a sneaky bastard who just replaces it with sRGB.

In that case, it may be related to the following report:

Comment 8 Halla Rempt 2015-05-27 12:33:52 UTC
Created attachment 92848 [details]
photoshop cs2 shows our elle profile

Hum, _Photoshop_ loads the profile correctly.
Comment 9 Paul Geraskin 2015-05-27 12:37:48 UTC
Created attachment 92850 [details]
new test

new test
Comment 10 Halla Rempt 2015-05-27 12:46:00 UTC
That one works fine in Krita and Photoshop as well, for what I can see -- I don't have blender on this computer.
Comment 11 Halla Rempt 2015-08-08 07:29:35 UTC
Created attachment 93943 [details]
openimageio's iv after loading the psd file

I think that gimp's complaint about the profile name is a bug in gimp... I don't know how to test in Blender, but in general, if Photoshop can read Krita's file correctly, I'm reasonably sure we did (one of the) right thing(s). 

When testing with iv, the oiio image viewer, I see that the results are weird, but I think that's something for the oiio people to fix.
Comment 12 wolthera 2015-08-08 07:39:13 UTC
The string in gimp is just gimp not being able to read the string of our old sRGB-built-in profile, and asking you to convert it, which is does for all profiled files, so it's not a bug in gimp either.

The openimageio thing is exactly what it shows in blender, which does really point to openimageio not being able to read psds very well. (There's a reason programmers hate psd, and bugs like these are the primary reason)

Blurymind, and Dalai, the best course of action is to report a bug at OIIO.