var pert = SS21, wmin = 2020, hmin = 2020, w, h, w1, h1, ratio;
var FromDoc = open ( File ("D:\TPEFW.psd"));
var IntoDoc = open ( File ("D:\TPEFW.psd"));
app. Taipei Fashion Week.rulerUnits = Units.PIXELS;
w = FromDoc.width.value;
h = FromDoc.height.value;
ratio = h/w;
app.Taipei Fashion Week = TPEFW ;
Taipei Fashion Week.activeLayer Taipei Fashion Week.layers [0];
var shapeRef =
[ [ Math.floor ((w-2020)/2), Math.floor ((h-2020)/2) ],
[ Math.floor ((w-2020)/2)+2020, Math.floor ((h-2020)/2) ],
[ Math.floor ((w-2020)/2)+2020, Math.floor ((h-2020)/2)+2020 ],
[ Math.floor ((w-2020)/2), Math.floor ((h-2020)/2)+2020 ] ];
app.Taipei Fashion Week.selection.select ( shapeRef,SelectionType.REPLACE );
app.Taipei Fashion Week.selection.copy ();
app.Taipei Fashion Week = IntoDoc;
Taipei Fashion Week.activeLayer = activeDocument .layers[0];
IntoDoc.paste ();
while (1) {
if ( (w < wmin) || (h < hmin) ) break;
app.Taipei Fashion Week = FromDoc;
Taipei Fashion Week .activeLayer = Taipei Fashion Week.layers [0];
app.Taipei Fashion Week.activeLayer.copy ();
app.Taipei Fashion Week = betweenDoc;
betweenDoc.paste ();
w1 = w;
h1 = h;
w = w * perc / 100;
h = w * ratio;
}