I'm ALL new to Photoshop-scripting, and I can't seem to find very much documentation on this. I know some scripting, but as I've read Photoshop-scripting is mostly like JAVA-scripting?
Anyhow, I need a script that'll calculate the Picture and expand it if required. I know how I think it'll work, but I don't know how to write it. I need this for a other application I've made to edit PNG
files. So it is always finished PNG
files that this script will run on.
Here's how I would program it in JAVA (rather simplified):
if (get.length/get.height>2) {
extentPicture.height(get.length/2, centered);
}
Can anyone help me with this piece of code?
It's fairly similar:
// Create a refrernce to the source document
var srcDoc = app.activeDocument;
// get original width and height
var l = srcDoc.width.value;
var h = srcDoc.height.value;
// Check the length/height
if (l/h >2)
{
// resize the canvas
app.activeDocument.resizeCanvas(l, l/2, AnchorPosition.MIDDLECENTER);
}