Skip to main content
This topic has been closed for replies.
Correct answer Stephen Marsh

Not sure about DOM code, however It can be recorded as AM code via ScriptListener and somewhat beautified and made intelligible with the Clean SL script:

 

imageSize();

function imageSize() {
  var c2t = function (s) {
  return app.charIDToTypeID(s);
  };
  var s2t = function (s) {
  return app.stringIDToTypeID(s);
  };
  var descriptor = new ActionDescriptor();
  descriptor.putUnitDouble( s2t( "width" ), s2t( "percentUnit" ), 200.000000 ); // 200% resample value
  descriptor.putBoolean( s2t( "scaleStyles" ), true );
  descriptor.putBoolean( s2t( "constrainProportions" ), true );
  descriptor.putEnumerated( c2t( "Intr" ), s2t( "interpolationType" ), s2t( "deepUpscale" )); // Preserve Details 2.0
  descriptor.putInteger( s2t( "noise" ), 25 ); // Reduce Noise
  executeAction( s2t( "imageSize" ), descriptor, DialogModes.NO );
}

 

 

EDIT: In CC2018 I can only get DOM code to work for the original Preserve Details algorithm, not Preserve Details 2.0 which has no entry in the JS Reference:

 

app.activeDocument.resizeImage( '200%', '200%', undefined, ResampleMethod.PRESERVEDETAILS, 25 )

 

1 reply

Stephen Marsh
Community Expert
Stephen MarshCommunity ExpertCorrect answer
Community Expert
February 27, 2019

Not sure about DOM code, however It can be recorded as AM code via ScriptListener and somewhat beautified and made intelligible with the Clean SL script:

 

imageSize();

function imageSize() {
  var c2t = function (s) {
  return app.charIDToTypeID(s);
  };
  var s2t = function (s) {
  return app.stringIDToTypeID(s);
  };
  var descriptor = new ActionDescriptor();
  descriptor.putUnitDouble( s2t( "width" ), s2t( "percentUnit" ), 200.000000 ); // 200% resample value
  descriptor.putBoolean( s2t( "scaleStyles" ), true );
  descriptor.putBoolean( s2t( "constrainProportions" ), true );
  descriptor.putEnumerated( c2t( "Intr" ), s2t( "interpolationType" ), s2t( "deepUpscale" )); // Preserve Details 2.0
  descriptor.putInteger( s2t( "noise" ), 25 ); // Reduce Noise
  executeAction( s2t( "imageSize" ), descriptor, DialogModes.NO );
}

 

 

EDIT: In CC2018 I can only get DOM code to work for the original Preserve Details algorithm, not Preserve Details 2.0 which has no entry in the JS Reference:

 

app.activeDocument.resizeImage( '200%', '200%', undefined, ResampleMethod.PRESERVEDETAILS, 25 )

 

JJMack
Community Expert
Community Expert
February 27, 2019

When Adobe add tings ro Photoshop the often doe nor doe a through job and  this can cause bugs. When Adobe first added Interpolation Bicubic Aromatic scripts could not set that as a preference it was not added to scripting support.  So when my script retrieved the users preference and change it to way I wanted used when my script restored the users preference  Photoshop would end the  script  stating an internal Photoshop program error if the users preference was bicubic Automatic This was fixes in CC verion of CS6.  This time when Adobe added  Preserve Details 2 Adobe did not even  add it to Photoshop preferences, even the original preserve details can not be set as a preference

JJMack