List of supported features
bryab opened this issue · 6 comments
Hey fellas, thanks for making this library. I am currently using the "psd_tools" library for Python, but was considering rewriting this tool I've made in Rust. However I'm pretty sure this library is not nearly as complete as that one. Do you have a list of supported/unsupported features?
My requirement is just the ability to "merge" (composite) a layer group into a single image, with respect to the following features:
- Adjustment Layers
- Blending Modes
- Clipping Masks
- Masks
Is this currently possible? Would be happy to help but I am unfortunately not a Rust expert. I will say, the psd_tools library may be a good resource for you all for reference.
Hey!
There isn't currently a list of supported/unsupported features - but you're totally right that it's something that we need. I'll leave this issue open until that exists.
I'll go feature by feature on what you're looking for:
Compositing layer groups
A week ago #13 landed introducing support for layer groups.
You can retrieve all of the groups or a group by name using methods such as:
https://docs.rs/psd/0.1.7/psd/struct.Psd.html#method.group_by_name
Then use Psd.flatten_layers_rgba
to flatten only the layers in that group
Adjustment layers
Right now we respect the size of layers when compositing
Lines 266 to 272 in 9709677
but not much else.
Supporting adjustment layers would come down to tweaking our layer blending to respect the settings of the layer.
Blending Modes
Right now we blend layers linearly and don't respect the blending mode.
Lines 342 to 348 in 9709677
Changing this would involve looking at the layer's blend mode and using that to decide what function to call to blend two pixels.
Clipping masks / masks
Same here - we don't respect it - but would just boil down to sprinkling in some code to look at the clipping mask and do the right thing.
Why aren't these things supported?
So far the psd
crate has evolved from people's needs.
Most recently someone needed support for groups - boom they PRd group support.
The process of adding new functionality typically boils down to adding a test against a new test psd file (or an existing one if applicable)
https://github.com/chinedufn/psd/tree/master/tests/fixtures
Would be happy to help but I am unfortunately not a Rust expert
I'd be more than happy to give you very detailed notes, thoughts and direction on how to add any functionality that you might want to add.
We're already reading all of the data that is needed - we just end up ignoring a lot of it right now.
So adding functionality typically involves adding a test .psd
file and then sprinkling in code in a few self-contained locations to make the test pass - which I'd be more than happy to point you towards.
So yeah - if you have the interest I'm more than happy to help with detailed pointers/guidance through where to add things, otherwise feel free to check back in the future when more of this is hopefully in place!
Thanks!! Glad to see you all are interested in building up this library. I would love to help and I might try to dive in and try implementing some of those things. I have done a lot of work with blending modes in various contexts, so I'm pretty familiar with the math involved.
That's awesome! Your experience with blending modes would be super useful.
Cool - let me know if you ever end up diving in since I'm more than happy (excited) to answer any questions that you might have about the codebase / Rust / etc.
Now that #15 landed most of this is supported but I'll keep this issue open until I make time to add some documentation to the guide.
I wanted to make you aware of the C++ .psd
code library, at https://github.com/MolecularMatters/psd_sdk, which uses the BSD-2-Clause license. Overview page at https://molecular-matters.com/products_psd_sdk.html.