Skip to main content
Inspiring
August 16, 2023
Question

Reset Photoshop's resize interlopationMethod

  • August 16, 2023
  • 3 replies
  • 445 views

Is there a way with AM code to reset the image resize interpolationMethod to automatic in Photoshop??

The transform interpolationMethod can be reset with scriptlistner code (by resizing a temp image to 100 x 100), 

 

 

 

    // select all first
    activeDocument.selection.selectAll();
    
    // =======================================================
    var idTrnf = charIDToTypeID( "Trnf" );
    var desc6800 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
    var ref2411 = new ActionReference();
    var idLyr = charIDToTypeID( "Lyr " );
    var idOrdn = charIDToTypeID( "Ordn" );
    var idTrgt = charIDToTypeID( "Trgt" );
    ref2411.putEnumerated( idLyr, idOrdn, idTrgt );
    desc6800.putReference( idnull, ref2411 );
    var idFTcs = charIDToTypeID( "FTcs" );
    var idQCSt = charIDToTypeID( "QCSt" );
    var idQcsa = charIDToTypeID( "Qcsa" );
    desc6800.putEnumerated( idFTcs, idQCSt, idQcsa );
    var idOfst = charIDToTypeID( "Ofst" );
    var desc6801 = new ActionDescriptor();
    var idHrzn = charIDToTypeID( "Hrzn" );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc6801.putUnitDouble( idHrzn, idPxl, 0.000000 );
    var idVrtc = charIDToTypeID( "Vrtc" );
    var idPxl = charIDToTypeID( "#Pxl" );
    desc6801.putUnitDouble( idVrtc, idPxl, 0.000000 );
    var idOfst = charIDToTypeID( "Ofst" );
    desc6800.putObject( idOfst, idOfst, desc6801 );
    var idWdth = charIDToTypeID( "Wdth" );
    var idPrc = charIDToTypeID( "#Prc" );
    desc6800.putUnitDouble( idWdth, idPrc, 100.0 );
    var idHght = charIDToTypeID( "Hght" );
    var idPrc = charIDToTypeID( "#Prc" );
    desc6800.putUnitDouble( idHght, idPrc, 100.0 );
    var idIntr = charIDToTypeID( "Intr" );
    var idIntp = charIDToTypeID( "Intp" );
    var idbicubicAutomatic = stringIDToTypeID( "bicubicAutomatic" );
    desc6800.putEnumerated( idIntr, idIntp, idbicubicAutomatic );
    executeAction( idTrnf, desc6800, DialogModes.NO );

 

but it doesn't seem to work for image resize as well:

 

 

Basically I spend a lot of time changing the resize interpolation types and I'd quite like a way to reset it.

You know... for when the coffee runs out.

 

 

This topic has been closed for replies.

3 replies

Stephen Marsh
Community Expert
Community Expert
August 18, 2023

@Ghoul Fool – The Image Size dialog is sticky, it remembers the last used interpolation method (even after quit and restart). I'm not sure which preference or other file holds this info.

 

One could create an action or script that will create a new 1x1 px size temp doc, resize the image using image size with the interpolation set to automatic and then close the temp doc without saving. This would be triggered via the Script Events Manager for the Start Application event. This should reset the image size window to use Automatic the next time that it is used. I have not tested this.

Inspiring
August 18, 2023

@Stephen Marsh That's my exact thoughts - although the script alone doesn't seem to change the image size interpolation as you would expect. I've not tried that with the Events Manager as I'm not sure if that would make a difference. I'll keep experimenting.

D Fosse
Community Expert
Community Expert
August 17, 2023

You set interpolation in two places - in Image Size and in general Preferences.

 

The default interpolation you set in Preferences is independent from what you set in Image Size. The Preferences setting applies to all instances where the Image Size dialog is not invoked. Which is a lot.

 

The Image Size setting applies to Image Size, but does not change the general default.

Stephen Marsh
Community Expert
Community Expert
August 16, 2023

Have you looked at the output when changing preferences?

Inspiring
August 17, 2023

Output for what?? - Sorry, I get thrown easily when out of context - you'll have to be more explicit. #autism

Stephen Marsh
Community Expert
Community Expert
August 17, 2023

The script listener output when you change interpolation in prefs.

 

Otherwsise it is done in image size, either using DOM code or AM code for unsupported interpolation methods.