Resample image

Anyone, especially newbies, asking for help with Photoshop Scripting and Photoshop Automation - as opposed to those contributing to discussion about an aspect of Photoshop Scripting

Moderators: Tom, Kukurykus

appu123

Resample image

Post by appu123 »

HI
Here is my code to fix image size but it is not working fine
doc = app.activeDocument;
doc.changeMode(ChangeMode.CMYK);
var Width = 600;
var Height = 500;
var RulerUnits = preferences.rulerUnits;
preferences.rulerUnits = Units.POINTS;
if (doc.width> Width)
{

doc.resizeImage(width,null,null,ResampleMethod.NONE);
}
else if(doc.height> height)
{

doc.resizeImage(null,Height,null,ResampleMethod.NONE);
}
in above code i get error in the line (doc.resizeImage(width,null,null,ResampleMethod.NONE);)
now i want to untick the ResampleMethod, i want to size the image in points, not in pixels and resolution of the image
please any one help me

Thanks
Appu

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Resample image

Post by Mike Hale »

One reason for the error is javascript is case sensitive. You define Width but use width.

Even with that corrected you can't supply the width or height unless you resample. If you want to change either of those without resampling you need to do the math to determine at what ppi will give you the desired size then set only the resolution in the imageResize.

doc.resizeImage(undefined,undefined,175,ResampleMethod.NONE);