Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Reset Photoshop's resize interlopationMethod

Engaged ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

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), 

 

GhoulFool_1-1692204716953.png

 

 

    // 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:

 

GhoulFool_0-1692204447602.png

 

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.

 

 

TOPICS
Actions and scripting

Views

306
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Aug 16, 2023 Aug 16, 2023

Copy link to clipboard

Copied

Have you looked at the output when changing preferences?

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

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

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

I did not know they were set in preferences. *looks shocked and slightly embarrassed*

 

it can be set with SL code:

 

function reset_interpolation_in_preferences()
{
    // =======================================================
    var idsetd = charIDToTypeID( "setd" );
    var desc30 = new ActionDescriptor();
    var idnull = charIDToTypeID( "null" );
    var ref8 = new ActionReference();
    var idPrpr = charIDToTypeID( "Prpr" );
    var idGnrP = charIDToTypeID( "GnrP" );
    ref8.putProperty( idPrpr, idGnrP );
    var idcapp = charIDToTypeID( "capp" );
    var idOrdn = charIDToTypeID( "Ordn" );
    var idTrgt = charIDToTypeID( "Trgt" );
    ref8.putEnumerated( idcapp, idOrdn, idTrgt );
    desc30.putReference( idnull, ref8 );
    var idT = charIDToTypeID( "T   " );
    var desc31 = new ActionDescriptor();
    var idIntM = charIDToTypeID( "IntM" );
    var idIntp = charIDToTypeID( "Intp" );
    var idbicubicAutomatic = stringIDToTypeID( "bicubicAutomatic" );
    desc31.putEnumerated( idIntM, idIntp, idbicubicAutomatic );
    var iduseClassicFileNewDialog = stringIDToTypeID( "useClassicFileNewDialog" );
    desc31.putBoolean( iduseClassicFileNewDialog, true );
    var idGnrP = charIDToTypeID( "GnrP" );
    desc30.putObject( idT, idGnrP, desc31 );
    executeAction( idsetd, desc30, DialogModes.NO );
}

 

Thanks for the clarification.  

 

However, that doesn't change how image size is interpolated.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

quote

However, that doesn't change how image size is interpolated.


By @Ghoul Fool

 

Perhaps I don't understand the issue...

 

Did you see the reply from @D Fosse ?

 

If you are scripting the image size step, the DOM code is:

 

https://theiviaxx.github.io/photoshop-docs/Photoshop/Document/resizeImage.html

https://theiviaxx.github.io/photoshop-docs/Photoshop/ResampleMethod.html#resamplemethod

 

// width and height to fixed values

activeDocument.resizeImage(UnitValue(1000, "px"), UnitValue(1000, "px"), null, ResampleMethod.AUTOMATIC);

// or width only to fixed value

activeDocument.resizeImage(UnitValue(1000, "px"), null, null, ResampleMethod.AUTOMATIC);

// or height only to fixed value

activeDocument.resizeImage(null, UnitValue(1000, "px"), null, ResampleMethod.AUTOMATIC);

 

Or for an interactive AM code:

 

var idimageSize = stringIDToTypeID("imageSize");
    var origRulers = app.preferences.rulerUnits;
    app.preferences.rulerUnits = Units.PIXELS;
    var w = activeDocument.width.value;
    var h = activeDocument.height.value;
    var r = activeDocument.resolution;
    var desc266 = new ActionDescriptor();
    var idwidth = stringIDToTypeID( "width" );
    var idpixelsUnit = stringIDToTypeID( "pixelsUnit" );
    desc266.putUnitDouble( idwidth, idpixelsUnit, w );
    var idheight = stringIDToTypeID( "height" );
    var idpixelsUnit = stringIDToTypeID( "pixelsUnit" );
    desc266.putUnitDouble( idheight, idpixelsUnit, h );
    var idresolution = stringIDToTypeID( "resolution" );
    var iddensityUnit = stringIDToTypeID( "densityUnit" );
    desc266.putUnitDouble( idresolution, iddensityUnit, r );
    var idinterfaceIconFrameDimmed = stringIDToTypeID( "interfaceIconFrameDimmed" );
    var idinterpolationType = stringIDToTypeID( "interpolationType" );
    var idautomaticInterpolation = stringIDToTypeID( "automaticInterpolation" );
    desc266.putEnumerated(idinterfaceIconFrameDimmed, idinterpolationType, idautomaticInterpolation);
    app.preferences.rulerUnits = origRulers;
executeAction(idimageSize, desc266, DialogModes.ALL);

 

 

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 17, 2023 Aug 17, 2023

Copy link to clipboard

Copied

@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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Aug 18, 2023 Aug 18, 2023

Copy link to clipboard

Copied

LATEST

@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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines