The first thing I would say is your script alert shows 640 px X 480 px for you Photoshop ruler units are set to pixels. The script does not set the ruler units to pixels so you might as easily see 100 % X 100 % or 4 in X 3 in be careful when writhing scripts as to what units Photoshop is currently set to use,
Thank you. Good advice. The ruler units are pixels, but I didn't do anything explicitly in the code to set that. I'm just trying little snippets of code to learn from, rather than trying to do too much at one time. You don't think that's the issue with resizeImage, do you?
If I just open the image in Photoshop and then run the following, it works:
docRef = app.activeDocument
docWidthNew = 500
docHeightNew = 375
does this help
docRef.resizeImage(docWidthNew + ' px' ,docHeightNew + " px")
You the man !!!
docRef.resizeImage(docWidthNew + ' px',docHeightNew + ' px')
as you suggested (I assumed the mixed single and double quotes in your post were a typo) and, voila, the script then worked as expected. Thank you.
But that leaves me a bit confused. There was nothing in the Scripting Guide to indicate you needed ' px' in the statement. I think I'm getting the drift of what you are saying about losing the units when I did math on the retrieved width and height.
I wonder why the height was coming out as expected, and only the width was wrong. And why the little snipet of code I showed in my third post in this thread worked since I was only send resizeImage pure numbers without any units.
Anyhow, is there anywhere where all this might be spelled out a bit more?