adobe - How does Photoshop Bounds/Crop Work JavaScript -


i've been trying make script crop folder of files, run variety of problems.

the documentation says: "...the bounds parameter array of 4 coordinates region remaining after cropping, [left, top, right, bottom]."

for example, set bounds full document

var bounds = [0,0,doc.width,doc.height]; 

and try crop desired dimensions no angle, scales image down.

doc.crop(bounds, undefined, desiredwidth, desiredheight); 

i have tried identify center of file , set dimensions going left half of desired width, half desired height, right half desired with, , down half desired height make area , crop it.

var bounds = [(centerx-halfwidth),(centery+halfheight),(centerx+halfwidth),(centery-halfheight)]; doc.crop(bounds); 

when try this, warning not have enough ram.

what missing crop image instead of resizing it?

try

app.activedocument.resizecanvas(w, h, anchorposition.middlecenter); 

Comments