Copy link to clipboard
Copied
Hi Everyone,
Is this possible to draw rectangle selection using Fixed Ratio("2:3" or "4:5") based on the product...?
I have T-Shirt image on the background and I need to draw rectangle using Fixed Ratio based on the Tshirt.
Note: I get Height and Width of T-shirt which is from Overall T-shirt Path
Anyone Please guide me to complete this task. Thanks in advance.
-yajiv
Copy link to clipboard
Copied
How did that path get created? Is it of a t-shirt on a flat surface? Is it long or short? Sleeved or sleeveless? It easy to create fixed aspect ratio selections and path. You still need to know what size you want and where you want then to be.
Copy link to clipboard
Copied
Thanks for your reply JJ Mack,
Yes I put manual path on t-shirts which is placed on flat surface background. The size of T-shirt may vary on height or width. I need to draw 2:3 fixed ratio rectangle selection on the t-shirts. Waiting for your suggestion..?
Note: the fixed ratio section biger than t-shirts height and width.
-yajiv
Copy link to clipboard
Copied
natrev wrote:
Thanks for your reply JJ Mack,
Yes I put manual path on t-shirts which is placed on flat surface background. The size of T-shirt may vary on height or width. I need to draw 2:3 fixed ratio rectangle selection on the t-shirts. Waiting for your suggestion..?
Note: the fixed ratio section biger than t-shirts height and width.
-yajiv
If your making a manual path for the t-shirts why not make a manual 3:2 aspect selection or path instead. You can set the rectangle marquee tool to a fixed 3:2 aspect ratio mode and drag out a 3:2 selection on tthe t-shirt and reposition it. The selection can be turned into a path if you need a path. It would be much easier then using the pen tool to create a path for the t-shirt.
Copy link to clipboard
Copied
Once again thanks for your reply JJ Mack,
If I make a manual 3:2 aspect selection, sometime made mistakenly went to wrong (unfortunate manually adjust the selection using transform)
Thats the reason I need to automate the 3:2 aspect ratio based on the product (t-shirt) selection. I don't know how the calculation 3:2 aspect ratio work on.
Please guide me to complete this task. Thanks in advance.
-yajiv
Copy link to clipboard
Copied
Once you make a 3:2 selection with the selection tool set to fixed Aspect ratio or make an automated 3:2 aspect ratio selection. You can use the transform tool to adjust its size and location while constrain it to the 3:2 aspect ration by holding down the constraining modifier Shift key. Even if you make an automated 3:2 aspect selection within the path you manually make. You would still need to manually adjust the selection. For you state that paths differ for t-shirts sizes and most likely styles change. Long. Short, sleeved and sleeveless etc. All you can easily get for a path is its bounds the max with and height. Where you want the 3:2 selection will differ as will the size you want you may not be able to tell size.
Copy link to clipboard
Copied
Yes JJ Mack,
Absolutely correct, that's the reason I need that 2:3 calculation formula and how it derived start to end.
After that I can draw a rectangle 2:3 as per T-shirt based on the height or width. Thanks in advance.
-yajiv
Copy link to clipboard
Copied
Now you have lost me the formula is a 2:3 ratio. Where the start and end point the top left and bottom right point which will be some place within the path. Where the top left point will be can vary it depend on the t-shirt size and design. The bottom right point also depend on the t-shirt size and design. There is no way to know from the bounds of the t-shirt path where the starting point should be located. You stated that the path creation is a manual thing. I suggested you should just do the 2:3 selection manually instead. I still feel that is what you should do. IMO a path for the t-shirt is not useful all you know from that is the boundaries the t-shirt has and its position over the canvas. You do not have information for locating the chest area. You would need some complex logic to analyze the t-shirt path shape to be able to pinpoint the chest area,
Copy link to clipboard
Copied
Once again thanks for your reply JJ Mack,
I tried, but I can't able make it perfect. Alternatively, I tired one code, But Its draw very little rectangle.
Can you fix it if possible...?
Anyone help me, let me come this problem..
-yajiv
main();
function main(){
if(!documents.length) return;
var strtRulerUnits = app.preferences.rulerUnits;
var strtTypeUnits = app.preferences.typeUnits;
app.preferences.rulerUnits = Units.INCHES;
app.preferences.typeUnits = TypeUnits.PIXELS;
var docRef = app.activeDocument;
docRef.selection.load(docRef.channels.getByName("ol"), SelectionType.REPLACE, false);
var bounds=docRef.selection.bounds;
var W = Number(bounds[2] - bounds[0]);
var H = Number(bounds[3] - bounds[1]);
docRef.selection.expand(45.0);
var Nbounds=docRef.selection.bounds;
docRef.selection.deselect();
var NW = Number(Nbounds[2] - Nbounds[0]);
var NH = Number(Nbounds[3] - Nbounds[1]);
NHeight=NW*1.5;// New Height with 2:3 ratio
x=Number(NHeight)-Number(NH); Difference
Left=Nbounds[0];
Top=Nbounds[1];
Right=Nbounds[2];
Bottom=Nbounds[3]+x;
var WD=Right-Left;
var HI=Bottom-Top;
alert(Left+"\t"+Top+"\t"+Right+"\t"+Bottom+"\n"+WD+"\t"+HI);
docRef.selection.select([[Left,Top],[Right,Top],[Right,Bottom],[Left,Bottom]], SelectionType.REPLACE, 0, false);
}
Copy link to clipboard
Copied
It is easy to make a aspect ratio selection. The Problem here is you have no way to know what size the selection should be or where it should be located. Your making a Path around an image of a t-shirt manually. You seem to think that will help you solve your problem. The thing is I do not see that helping with your problem. It is easer and quicker to just make a manual aspect ratio selection over the t-shirt image chest area.
T-shirt bounds will not help. The bounds are the top of the neck, bottom shirt tail, left and right sleeves. T-shirts vary in sleeve style, neck style, body width and also in shirt length. Many styles of T-shirts will have the same bound. automating a 3:2 selection based on t-shirt bounds will not be satisfactory considering t-shirt styles.
http://www.mouseprints.net/old/dpr/AspectRatioSelection.jsx