Copy link to clipboard
Copied
I will try Another PNG File But Select All , I want to inside frame only
1 Correct answer
For your examples, this is to poke a magic wand in the center of the layer.
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("bounds"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var d = executeActionGet(r).getObjectValue(stringIDToTypeID("bounds"));
var x0 = d.getUnitDoubleValue(stringIDToTypeID("left"));
var x1 = d.getUnitDoubleValue(stringIDToTypeID("right"));
var y0 = d.getUnitDouble
...
Explore related tutorials & articles
Copy link to clipboard
Copied
Have you read what I wrote to you: Jul 07, 2021
Copy link to clipboard
Copied
If you know the Png Subject is a frame like you show with an empty images area. You can use the Magic wand to sample the center of the layers bounds to select the empty image ares then the use the bounds of the active selection to get the bounds you want. Makes no different what shape the Image area has. The selection bounds is what you seem to want. The center of a frame will most likely be empty Magic wand should select the image area sampleing the center.
Copy link to clipboard
Copied
For your examples, this is to poke a magic wand in the center of the layer.
var r = new ActionReference();
r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("bounds"));
r.putEnumerated(stringIDToTypeID("layer"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));
var d = executeActionGet(r).getObjectValue(stringIDToTypeID("bounds"));
var x0 = d.getUnitDoubleValue(stringIDToTypeID("left"));
var x1 = d.getUnitDoubleValue(stringIDToTypeID("right"));
var y0 = d.getUnitDoubleValue(stringIDToTypeID("top"));
var y1 = d.getUnitDoubleValue(stringIDToTypeID("bottom"));
var d = new ActionDescriptor();
var r = new ActionReference();
r.putProperty(stringIDToTypeID("channel"), stringIDToTypeID("selection"));
d.putReference(stringIDToTypeID("null"), r);
var d1 = new ActionDescriptor();
d1.putUnitDouble(stringIDToTypeID("horizontal"), stringIDToTypeID("pixelsUnit"), (x0+x1)/2);
d1.putUnitDouble(stringIDToTypeID("vertical"), stringIDToTypeID("pixelsUnit"), (y0+y1)/2);
d.putObject(stringIDToTypeID("to"), stringIDToTypeID("point"), d1);
d.putInteger(stringIDToTypeID("tolerance"), 255);
d.putBoolean(stringIDToTypeID("merged"), true);
d.putBoolean(stringIDToTypeID("antiAlias"), true);
executeAction(stringIDToTypeID("set"), d, DialogModes.NO);
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This is not related to original question, for what the working solution was already given.
Copy link to clipboard
Copied
Copy link to clipboard
Copied
This is another aproach to same problem, after MXKS gave up with this thread 😉
Copy link to clipboard
Copied
Yes @Kukurykus That was same problem, It helped from @r-bin ,
Thanks @Kukurykus For Help and Guide
Copy link to clipboard
Copied
Once again, why simply you can't answer for that I linked you in this post: Jul 07, 2021
Copy link to clipboard
Copied
If you know the Png Subject is a frame like you show with an empty images area. You can use the Magic wand to sample the center of the layers bounds to select the empty image ares then the use the bounds of the active selection to get the bounds you want. Makes no differebcs what shape the Image area has. The selection bounds is what you seem to want.
Copy link to clipboard
Copied
This answer matches the original question. It does "under ratio selection". What's not clear?
Who removed the correct answer? ðŸ˜
Copy link to clipboard
Copied
Author still did not explain what he means by 'under ratio selection', but due to many first posts of this thread I already left an answer according to that what he wanted: Jul 07, 2021
There is not said in his original post he wants to select only inner part of frame as like you see it was already selected. Anyway he accepted solutions to subrequest alike yours, here & here.

