I have an image when manually resized to width 1000pts the resolution comes to 261.5pixels/inch
Original Image Dimensions
Manual Update width to 1000pts
The resolution downgraded to 261.5 px/in
When i try the same programmatically with js script the width changes but resolution is same as of the original image
JS Code
document.resizeImage(UnitValue(parseInt(row.width),"pt"), null, null); //working
where row.width = 1000
Image dimensions after executing the js script
How to calculate the resolution of the image automatically and set to 261.5px/inch
2
Answers
The new resolution should be manually calculated.
If the width is changed, the height will be changed programatically, which caused an impression, ResampleMethod.NONE will set the resolution too.
Not sure if you want to shrink the image or the canvas. I’ve got with the former.
Use
app.activeDocument.resizeImage
with a width, height and resolution of your image.Also check what units you are using.
alert(app.preferences.rulerUnits);