Bug in CS4 resizeImage?

Discussion of actual or possible Photoshop Scripting Bugs, Anomalies and Documentation Errors

Moderators: Tom, Kukurykus

Dropbear67

Bug in CS4 resizeImage?

Post by Dropbear67 »

Hi All.. I have a script I've been using in CS3 to export images in Full Size JPEG and then 1200 pixels on longest axis).

The script basically 'hangs' at the call to rezizeImage. RAM usage goes to max and it basically does nothing ..

The line in question causing the hang is
Code: Select alldoc.resizeImage(undefined, newImgSize, undefined, ResampleMethod.BICUBICSHARPER)



I've tried using ResampleMethod.NONE but it doesnt make any difference.


Full script is below.

Code: Select all// SaveJPEG.js
//  some code and resources found on internet
//
//
odoc = app.activeDocument;
var doc = app.activeDocument.duplicate();
//
doc.convertProfile("sRGB IEC61966-2.1",Intent.RELATIVECOLORIMETRIC,true,true);
app.displayDialogs = DialogModes.NO;
//
var filePath = decodeURI(odoc.path);
var fileName = decodeURI(odoc.name).slice(0,-4);
//Set restore pointvar savedState = doc.activeHistoryState;
//
// Produce the full size jpeg image in 10 quality
SaveFile = new File(filePath + "/" + fileName + "_FullSize.jpg");
SaveJPEG(SaveFile,12);
//
// call subroutine to resize to 1200 pixels on widest axis
fitImage(1200);
//
// Produce the 1200 pixel jpeg in 10 quality
SaveFile = new File(filePath + "/" + fileName + "_1200.jpg");
SaveJPEG(SaveFile,12);

// call subroutine to resize to 400 pixels on widest axis for thumbnails
//fitImage(400);
// Produce the thumbnail in 7 quality
//SaveFile = new File(filePath + "/" + fileName + "_Thumb.jpg");
//SaveJPEG(SaveFile,7);

doc.close(SaveOptions.DONOTSAVECHANGES);
alert("Image Saved!");


function fitImage(newImgSize) {   
    var doc = app.activeDocument; 
      if (doc.width > doc.height) {   
         doc.resizeImage(newImgSize, undefined, undefined, ResampleMethod.BICUBICSHARPER)   
         }   
      if (doc.width < doc.height) {             
         doc.resizeImage(undefined, newImgSize, undefined, ResampleMethod.BICUBICSHARPER)   
        }         
     if (doc.width == doc.height) {             
        doc.resizeImage(newImgSize, newImgSize, undefined, ResampleMethod.NONE)             
        }         
     }   

function SaveJPEG(saveFile, jpegQuality){
   jpgSaveOptions = new JPEGSaveOptions()
   jpgSaveOptions.embedColorProfile = true
   jpgSaveOptions.formatOptions = FormatOptions.STANDARDBASELINE
   jpgSaveOptions.matte = MatteType.NONE
   jpgSaveOptions.quality = jpegQuality //1-12
   app.activeDocument.saveAs(saveFile, jpgSaveOptions, true,Extension.LOWERCASE)
}



Any help would be greatly appreciated.

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

kevmann16

Bug in CS4 resizeImage?

Post by kevmann16 »

Anyone found a solution for this, my script was hanging during png saving but after a morning of googling and searching this forum I found this post, then after commenting out activeDocument.resizeImage(w,h) it runs perfectly.
xbytor

Bug in CS4 resizeImage?

Post by xbytor »

Code: Select alldoc.resizeImage(undefined, 1200, undefined, ResampleMethod.BICUBICSHARPER)

I just tried this and it works. I have my ruler units set to pixels in my PS prefs. If you have your units set to inches or percent, you might get some unusual behaviour.

This should work regardless of what you default ruler units are:

Code: Select alldoc.resizeImage(undefined, UnitValue(1200, "px"), undefined, ResampleMethod.BICUBICSHARPER)

-X
clarke

Bug in CS4 resizeImage?

Post by clarke »

remember it used to be Help > Resize Image
but that isnt there in cs4 any ideas where it is?

thanks
lukasz

Bug in CS4 resizeImage?

Post by lukasz »

clarke wrote:remember it used to be Help > Resize Image
but that isnt there in cs4 any ideas where it is?

thanks

its in image > image size