Link in Zwischenablage kopieren
Kopiert
This is a bit backward:
var imageHeight = app.activeDocument.height.value;
if (imageHeight == 224)
{
// do stuff
}
Didn't work for once - I assumed that image dimensions were ints, but there we go...
Casting it to an int worked:
if (parseInt(imageHeight) == 224)
{
// do stuff
}
Case closed.
But! Just out on curiousity, how do you get the float value of app.activeDocument.height??? - it always seems to report it as in int. Assuming that's what's going wrong.
I tried casting it as float and multiplying it by 1,000,000.
Link in Zwischenablage kopieren
Kopiert
Link in Zwischenablage kopieren
Kopiert
Units are pixels. Even without the "value" I get an object that's "244 px" and yet alert( app.activeDocument.height.value == 224) is false.
Link in Zwischenablage kopieren
Kopiert
Link in Zwischenablage kopieren
Kopiert
@Ghoul Fool this is a curious situation!
Did you explicitly set pixels as the unit of measure earlier in the script? Or was it just naturally assumed from the current ruler state?
EDIT: I just tested and even explicitly setting the units to px in the script still returns false.
Link in Zwischenablage kopieren
Kopiert
I'm glad you find it curious too!
There's no explicit unit set up in the script - as I use pixels so assume that's been set and not changed.
Secondly, the images size is an odd 200 dpi, 256 x 224 pixels (w & h)
Thirrdly resizing the image to 72 dpi, 256 x 224 pixels (w & h) - the script works fine.