In Javascript , how to crop the canvas from layer mask bounds ?

Community Beginner ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

Hello, despite all my researches i am struggling on this, i need to export multiple crops of an image, determined by the layers in the group "Gp CADRAGE".

 

I need to either :

- get the layermask active, invert it, and then crop to bounds of the mask

- or get a selection of the layer mask of active layer, invert it, and then crop to doc.selection.bounds

 

I tried to get a selection from the layer mask and then invert it, but i cannot select the layer mask propertly.

I tried to invert the alpha channel but i cannot get the alpha channel of the layer mask active.

 

Capture d’écran 2021-03-27 à 10.03.48.pngCapture d’écran 2021-03-27 à 10.10.33.png

 

I suppose that we can do it with actiondescriotor and actionreference etc, but don't understand how it works yet. So didn't get the code i found on the net to work 🙂

 

Thanks a lot if you can help me !

Martin

Views

41

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Most Valuable Participant ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

Adobe have many apps, and a lot of them have JavaScript. Please tell us the name of the app you are using, so your question can be moved to the best expert forum.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

oh sorry,  it is for Photoshop 🙂 thanks

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Mar 27, 2021 Mar 27, 2021

Copy link to clipboard

Copied

Moved to the Photoshop forum.

Likes

translate

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines