Skip to main content
Inspiring
October 10, 2023
Answered

Resizing an image in photoshop is failing.

  • October 10, 2023
  • 1 reply
  • 323 views

I'm sure I'm missing something but I'm attempting to resize an Image in photoshop with scripting and I can't get it to resize or save.  I believe I have an error in my resizeImage but I'm not sure what it is.  I believe I followed the guide correctly.

 

function saveFileJpg(saveFolder, fileName) {
    var doc = app.activeDocument;
    var v = new UnitValue(800, "px")

    doc.resizeImage(v, null, 72, ResampleMethod.NONE);

    var jpgFile = new File(saveFolder + '/' + fileName.replace(".psd", ".jpg"));
    var jpgOptions = new JPEGSaveOptions();

    jpgOptions.quality = 12;

    doc.saveAs (jpgFile, jpgOptions, true, Extension.LOWERCASE)
}
This topic has been closed for replies.
Correct answer Stephen Marsh

@OhmsG 

 

Why attempt to resize the width to 800px without resampling? It can't be done as px is the native unit!

 

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
October 11, 2023

@OhmsG 

 

Why attempt to resize the width to 800px without resampling? It can't be done as px is the native unit!

 

Participant
October 11, 2023

Ok got it, let me add the resampling.  Thank you!

I'll try it out and post results.