Copy link to clipboard
Copied
I'm trying write a script to test an open image to see if its below 1000px and if so res it up to 1000px, and also test if its above 10,000px and res it down to 10,000px. I think I would set this up as and else if statement but this does'nt work any ideas where I'm going wrong?
if(app.activeDocument.width.value<1000){e
app.activeDocument.resizeImage(
new UnitValue(1000, "px"),
currentHeight,
currentResolution,
ResampleMethod.BILINEAR);
}else if (app.activeDocument.width.value>10000){
app.activeDocument.resizeImage(
new UnitValue(10000, "px"),
currentHeight,
currentResolution,
ResampleMethod.BILINEAR);
}else {}
1 Correct answer
app.preferences.rulerUnits = Units.PIXELS;
Explore related tutorials & articles
Copy link to clipboard
Copied
If you keep currentHeight and currentResolution in variables, just remove e (at end of first line).
Copy link to clipboard
Copied
When I run this it does not work as expected. If its under 1000 it scales everything to 1000 including the spreads that are around 1200px, if its over it just doesn't do anything. Not sure whats going on here. Do I need to be specific about the pixels something like <1000px
These are the variables.
var currentHeight = null;
var currentResolution = 200;
W
Copy link to clipboard
Copied
What is spreads?
Copy link to clipboard
Copied
Sorry, these images are exports of book pages. So a single page may be 600px wide to 3000px wide, and a spread is two of those pages together. 1200px wide to potentialy over 10,000 px wide.
Copy link to clipboard
Copied
app.preferences.rulerUnits = Units.PIXELS;
Copy link to clipboard
Copied
Awesome, that was it. Thank you!
Copy link to clipboard
Copied
I had the same guess, but that was too obvious to suggest 🙂 btw Happy ACP activity 😉
Copy link to clipboard
Copied
Thanks, I still need lots of help but its starting to sink in.

