Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieving mask data #86

Open
igorski opened this issue Apr 23, 2023 · 3 comments
Open

Retrieving mask data #86

igorski opened this issue Apr 23, 2023 · 3 comments

Comments

@igorski
Copy link

igorski commented Apr 23, 2023

Hi there, great project and the 🚀 is impressive!

I have one question related to masked layers. Basically, I would like to retrieve an image buffer for the mask data (similar to retrieving the composite of the Psd file or the Layer, as an Uint8ClampedArray).

However, it's not clear how to consume this data. I understand that I can retrieve the masks bounding box reading the layer.maskData Objects left, right, top, bottom values. I also see that there is an ArrayBuffer inside the layer.layerFrame.userMask.data Object.

However, the length of said buffer does not match with the size of the mask (as it expected to be width * height * 4 in length). I was thinking that this buffer contains the alpha channel or gray scale data only, however after converting this to fit in an RGBA sized buffer, the rendered data does not reflect the original masks shape, with pixels basically all over the place. I also noticed that the Layer class has an async method getUserMask|getRealUserMask which seems to return RGBA-sized values, but once more the rendered data does not reflect the masks shape.

As such, I'm not sure how to read and render the mask buffer object. Is there something obvious I'm overlooking with regards to the mask size ?

@Muratcol
Copy link

Muratcol commented Jun 2, 2023

I'm having the same problem. Colors are not match without mask data

@ramca09
Copy link

ramca09 commented Jul 11, 2023

Hi, @igorski
Did you solve the mask buffer issue? 🤔

@igorski
Copy link
Author

igorski commented Jul 20, 2023

Hi @ramca09 I'm afraid not...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants