Photoshop Script Crop Resizes Image, Does Not Crop
Recently I have been trying to make a script that will find the center of an image, and crop the desired width and height. I have tried a few different tricks, but have had no luck.
One thing I tried was settomg the bounds to be the full document
var bounds = [0,0,doc.width,doc.height];And then I try to crop it by the desired dimensions with no angle, but the image is scaled down instead of being cropped.
doc.crop(bounds, undefined, desiredWidth, desiredHeight);I have tried something to identify the center of the file and then set the dimensions by going to the left by half of the desired width, up by half the desired height, to the right by half the desired with, and then down half the desired height to make the area and then crop it.
var bounds = [(centerX-halfWidth),(centerY+halfHeight),(centerX+halfWidth),(centerY-halfHeight)];
doc.crop(bounds);When I try do his, I get a warning that I do not have enough RAM. I was unsure if this is simply due to the laptop, or because I am making a ridiculous request.
How exactly does the crop function work? And for the bounds property, do I need to set the amount I want cropped by making the dimensions here, or is that within the crop function?
Any help or clarification would be greatly appreciated.
