Improvements to PSD compatibility (clipping mask) in Krita

This thread is a continuation of Add ability to save clipping masks in PSD files and make it cross compatible as much as possible, which meandered quite a bit and contained a lot of digressions. In this thread, I would like to ask any participant to stay on the topic.

Topic:

improving the PSD import/export functionality in Krita, so that it can detect clipping masks and import and export PSD files so that the end result whether opening in Krita or Photoshop (or potentially other programs) the inherit alpha or clipping mask is applied correctly.

Rules for the discussion:

  1. Do NOT talk about improving inherit alpha system in Krita. Assume the system works the exact same way it works right now. (Only when we establish and agree that there is no way we can make it work without changing the system - which we didn’t yet - maybe then we could talk about it, but I am making another topic for inherit alpha anyway.)

  2. Do not digress or go on tangent. Pondering over how professional Krita is if it can’t support clipping masks is a tangent, please don’t do this - we already know the reasons for bigger compatibility, if it isn’t implemented, it’s not because we don’t understand. Discussing how Krita shouldn’t need to read PSD files is also a tangent. Discussing how ORA should be the industry standard is also considered a tangent in this thread. (It all might be a very good topic for Lounge if you want, but this is a Feature Requests subforum, so please stay on topic).

Current issues to discuss/wonder about:

  1. Whether it’s possible to read from PSD file which layer is clipped and to what etc. From my reading of Krita’s code, it seemed like it might be actually easy; but I was told that the PSD file format is very tricky and the obvious answer might not be true. Maybe it just needs testing, though.

  2. Algorithm how to convert from purely clipping masks structure to inherit alpha structure; and then algorithm how to convert from inherit alpha to clipping masks. There are two possibilities:

    a) Everything happens automatically, which means the algorithm needs to cover all possibilities and be always correct.

    b) The PSD must be in a correct special structure to be converted to inherit alpha structure; and then, when you export to PSD, the layer stack must also be in a compatible layer structure to be converted into clipping mask structure. This one might be easier, but more tedious for the user, so it’s better to first try to figure out (a).

With 1., it probably needs a developer’s input. The 2. topic might be something that artist can hep with, especially if they are already familiar with visual programming. But even if not, it should be doable.

It could be written in English; like a list of steps to go through. For example: step X, check if the layer has an older (higher) sibling (layer on the same level, in the same group); if yes, go to step Y, if not, go to step Z. Or, step A, do this, step B, do something more. Or it could look like this graph: Krita onion skin issues chart by TiaRevlyn on DeviantArt (something I’ve made to quickly answer users on reddit, this was a very common issues back in a day; maybe now there are more tutorials).

1 Like

Thank you for this!

I’ll just copy/paste my proposal from the previous thread, when I was operating under the assumption that implementation of layer clipping mask functionality into Krita is unfeasible:

" I’m pretty sure an additional inherit alpha mode isn’t necessary at all, provided that:

  1. Krita is able to recognize and interchange clipping mask and inherit alpha enabled layers when importing/exporting PSD
  2. Automated creation of groups around these clipping mask enabled layers, and the layer they are clipped to, is possible when importing PSD

These are big assumptions though, so IDK if this is actually possible.

But essentially, compatible export is already possible if the user uses the proper folder structures, and #1 is possible. Import would be made compatible by automatically grouping layers with clipping mask enabled, with the layer they are clipped to, and converting them to inherit alpha layers. I think this would allow for functional clipping relationships when interchanging files, but I could be missing something since I haven’t tested.

If automated grouping isn’t possible, enabling inherit alpha for the clipping mask enabled layers when importing would be 3/4 of the battle at least, since the user can more easily see points of breakage and manually fix them when importing (as it is now, you have to know each and every layer meant to have layer clipping enabled in advance). So, if #2 is impossible but #1 is possible, cross-compatibility would still be much improved. "

One additional tweak I would like to add, is that I think the user should be able to toggle the default behavior of folders as pass-through mode enabled/disabled when importing PSD, or better yet, have automated detection of which folders should be set to which. For example, a group containing only unclipped layers of various blending modes should have pass-through enabled to behave properly, while a folder containing only layers clipped to a base layer, should have it disabled, or all clipping relationships will not be functioning properly.

Also, regarding point 2. from the OP, I’m pretty sure no algorithm can convert all possibilities of inherit alpha structures into clipping mask structures, at least not ones compatible with PSD. If the format for interchange was .CLIP, I think it could be done, but Photoshop’s clipping is much more limited. The only way to get the same composited result, would be destructive editing through merges and rearranging, at least as far as I can see.

Sorry for the wall of text, I’ll try to keep those much fewer and farther between this time and be as concise as I can, as I feel most of the walls weren’t being read last thread anyways, and contributed much to the talking in circles problem. Thanks again, and thank you if you read this!

1 Like