Photoshop CS6: hdr toning script not working

  • 1
  • Problem
  • Updated 6 years ago
  • Solved
  • (Edited)
I'm trying to apply the "HDR toning script" (found in the image - adjustments menu) to a series of photos. I figured out how to do it in cs5. Tried the same method with cs6 and it's not working. It seems to run the script, but it doesn't actually apply the settings. After it's executed, the image remains unchanged. I recorded actions the actions. File - Scripts - browse. loaded the script from the scripts folder and everything seemed normal, aside from the image not changing at all, as though the settings were not applied.

Any ideas? My only solution at the moment is going back to cs5.
Photo of Matt Molloy

Matt Molloy

  • 6 Posts
  • 1 Reply Like

Posted 6 years ago

  • 1
Photo of Matt Molloy

Matt Molloy

  • 6 Posts
  • 1 Reply Like
Here is the script:

var runtoneadjusterFromScript = true;
//@includepath "/c/Program Files/Adobe/Adobe Photoshop CS5/Required/"
//@include "HDRToning.jsx"
//@show include

// create a descriptor to hold settings
// this holds the default Surrealistic preset settings
var hdDesc = new ActionDescriptor;
hdDesc.putInteger( stringIDToTypeID( 'version' ), 6 );
hdDesc.putInteger( kmethodStr, 3 );
hdDesc.putDouble( stringIDToTypeID( 'radius' ), 495 );
hdDesc.putDouble( stringIDToTypeID( 'threshold' ), 3.63 );// strength
hdDesc.putDouble( stringIDToTypeID( 'center' ), 0.37 );// gamma
hdDesc.putDouble( stringIDToTypeID( 'brightness' ), -0.15 );// exposure
hdDesc.putDouble( stringIDToTypeID( 'detail' ), 300 );
hdDesc.putDouble( stringIDToTypeID( 'shallow' ), 0 );
hdDesc.putDouble( stringIDToTypeID( 'highlights' ), -100 );
hdDesc.putDouble( stringIDToTypeID( 'vibrance' ), 60 );
hdDesc.putDouble( stringIDToTypeID( 'saturation' ), 10);
hdDesc.putBoolean( stringIDToTypeID( 'deghosting' ), false );
var cDesc = new ActionDescriptor;
cDesc.putString( stringIDToTypeID( 'name' ), 'Default');
var cList = new ActionList;
var pDesc = new ActionDescriptor;
pDesc.putDouble( stringIDToTypeID( 'horizontal' ), 0 );
pDesc.putDouble( stringIDToTypeID( 'vertical' ), 0 );
pDesc.putBoolean( keyContinuity , false );// ?????
cList.putObject( charIDToTypeID( 'Pnt ' ), pDesc );
var pDesc = new ActionDescriptor;
pDesc.putDouble( stringIDToTypeID( 'horizontal' ), 49 );
pDesc.putDouble( stringIDToTypeID( 'vertical' ), 57 );
pDesc.putBoolean( keyContinuity , false );
cList.putObject( charIDToTypeID( 'Pnt ' ), pDesc );
var pDesc = new ActionDescriptor;
pDesc.putDouble( stringIDToTypeID( 'horizontal' ), 255 );
pDesc.putDouble( stringIDToTypeID( 'vertical' ), 255 );
pDesc.putBoolean( keyContinuity , false );
cList.putObject( charIDToTypeID( 'Pnt ' ), pDesc );
cDesc.putList( stringIDToTypeID( 'curve' ), cList );
hdDesc.putObject( kclassContour, classShapingCurve, cDesc );

// copy and modify doAdjustment from HDRToning to call convertFromHDRNoDialog
toneAdjuster.doAdjustment = function()
{
var removeHistory = false;

function doConversionNon32()
{
toneAdjuster.convert32(); // Make sure it's 32 bit
try {
convertFromHDRNoDialog( resultDepth, hdDesc );
}
catch (err)
{
undoLastEvent(); // Leave it the depth we found it if canceled
removeHistory = true; // Flag state containing this call must go too.
}
}

function doConversion32()
{
try {
convertFromHDRNoDialog( resultDepth, hdDesc );
}
catch (err)
{
removeHistory = true;
}
toneAdjuster.convert32(); // This is a no-op if the conversion cancelled
}

if ((app.documents.length > 0) && this.askFlatten() && this.askRGB())
{
var depthMap = {'BitsPerChannelType.EIGHT': 8, 'BitsPerChannelType.SIXTEEN': 16, 'BitsPerChannelType.THIRTYTWO': 16};
var resultDepth = depthMap[app.activeDocument.bitsPerChannel];
var was32 = app.activeDocument.bitsPerChannel == BitsPerChannelType.THIRTYTWO;
// Group the convert to & from into a single operation
if (was32)
app.activeDocument.suspendHistory(localize("$$$/HDRToning/HDR_Tone_State_name=HDR Toning"),
"doConversion32()");
else
// Group the convert up to 32 and convert down into a single operation
app.activeDocument.suspendHistory(localize("$$$/HDRToning/HDR_Tone_State_name=HDR Toning"),
"doConversionNon32()");

// If the operation was canceled, remove the history state
if (removeHistory)
killLastHistoryState();
}
}

toneAdjuster.doAdjustment();
Photo of Matt Molloy

Matt Molloy

  • 6 Posts
  • 1 Reply Like
using Extendscript result undefined as below

var runtoneadjusterFromScript = true;
//@includepath "/c/Program Files/Adobe/Adobe Photoshop CS5/Required/"
//@include "HDRToning.jsx"
//@show include

// create a descriptor to hold settings
// this holds the default Surrealistic preset settings
var hdDesc = new ActionDescriptor;
hdDesc.putInteger( stringIDToTypeID( 'version' ), 6 );
hdDesc.putInteger( kmethodStr, 3 );
hdDesc.putDouble( stringIDToTypeID( 'radius' ), 495 );
hdDesc.putDouble( stringIDToTypeID( 'threshold' ), 3.63 );// strength
hdDesc.putDouble( stringIDToTypeID( 'center' ), 0.37 );// gamma
hdDesc.putDouble( stringIDToTypeID( 'brightness' ), -0.15 );// exposure
hdDesc.putDouble( stringIDToTypeID( 'detail' ), 300 );
hdDesc.putDouble( stringIDToTypeID( 'shallow' ), 0 );
hdDesc.putDouble( stringIDToTypeID( 'highlights' ), -100 );
hdDesc.putDouble( stringIDToTypeID( 'vibrance' ), 60 );
hdDesc.putDouble( stringIDToTypeID( 'saturation' ), 10);
hdDesc.putBoolean( stringIDToTypeID( 'deghosting' ), false );
var cDesc = new ActionDescriptor;
cDesc.putString( stringIDToTypeID( 'name' ), 'Default');
var cList = new ActionList;
var pDesc = new ActionDescriptor;
pDesc.putDouble( stringIDToTypeID( 'horizontal' ), 0 );
pDesc.putDouble( stringIDToTypeID( 'vertical' ), 0 );
pDesc.putBoolean( keyContinuity , false );// ?????
cList.putObject( charIDToTypeID( 'Pnt ' ), pDesc );
var pDesc = new ActionDescriptor;
pDesc.putDouble( stringIDToTypeID( 'horizontal' ), 49 );
pDesc.putDouble( stringIDToTypeID( 'vertical' ), 57 );
pDesc.putBoolean( keyContinuity , false );
cList.putObject( charIDToTypeID( 'Pnt ' ), pDesc );
var pDesc = new ActionDescriptor;
pDesc.putDouble( stringIDToTypeID( 'horizontal' ), 255 );
pDesc.putDouble( stringIDToTypeID( 'vertical' ), 255 );
pDesc.putBoolean( keyContinuity , false );
cList.putObject( charIDToTypeID( 'Pnt ' ), pDesc );
cDesc.putList( stringIDToTypeID( 'curve' ), cList );
hdDesc.putObject( kclassContour, classShapingCurve, cDesc );

// copy and modify doAdjustment from HDRToning to call convertFromHDRNoDialog
toneAdjuster.doAdjustment = function()
{
var removeHistory = false;

function doConversionNon32()
{
toneAdjuster.convert32(); // Make sure it's 32 bit
try {
convertFromHDRNoDialog( resultDepth, hdDesc );
}
catch (err)
{
undoLastEvent(); // Leave it the depth we found it if canceled
removeHistory = true; // Flag state containing this call must go too.
}
}

function doConversion32()
{
try {
convertFromHDRNoDialog( resultDepth, hdDesc );
}
catch (err)
{
removeHistory = true;
}
toneAdjuster.convert32(); // This is a no-op if the conversion cancelled
}

if ((app.documents.length > 0) && this.askFlatten() && this.askRGB())
{
var depthMap = {'BitsPerChannelType.EIGHT': 8, 'BitsPerChannelType.SIXTEEN': 16, 'BitsPerChannelType.THIRTYTWO': 16};
var resultDepth = depthMap[app.activeDocument.bitsPerChannel];
var was32 = app.activeDocument.bitsPerChannel == BitsPerChannelType.THIRTYTWO;
// Group the convert to & from into a single operation
if (was32)
app.activeDocument.suspendHistory(localize("$$$/HDRToning/HDR_Tone_State_name=HDR Toning"),
"doConversion32()");
else
// Group the convert up to 32 and convert down into a single operation
app.activeDocument.suspendHistory(localize("$$$/HDRToning/HDR_Tone_State_name=HDR Toning"),
"doConversionNon32()");

// If the operation was canceled, remove the history state
if (removeHistory)
killLastHistoryState();
}
} **** RESULT UNDEFINED *****

toneAdjuster.doAdjustment();
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14147 Posts
  • 1765 Reply Likes
Hi Matt,

Have you tried posting for help on the scripting forums?:

http://forums.adobe.com/community/pho...

http://ps-scripts.com/bb/index.php
Photo of Matt Molloy

Matt Molloy

  • 6 Posts
  • 1 Reply Like
Not yet, but it sounds like a good idea.

Thanks Jeffrey!
Photo of Matt Molloy

Matt Molloy

  • 6 Posts
  • 1 Reply Like
OK, to answer my own question. I did a lot of messing around, but I think the only problem was that there's a new addition to the hdr toning script. There's a check box called "smooth edges" Since the cs5 version didn't have this, my old script didn't have it. So with a little digging around I (and help) found it.

Here's the new line... hdDesc.putBoolean(stringIDToTypeID("smooth"),true);

This is working for me now...

function doConversionNon32()
{
toneAdjuster.convert32(); // Make sure it's 32 bit
try {
convertFromHDRNoDialog( resultDepth, hdDesc );
}
catch (err)
{
undoLastEvent(); // Leave it the depth we found it if canceled
removeHistory = true; // Flag state containing this call must go too.
}
}

function doConversion32()
{
try {
convertFromHDRNoDialog( resultDepth, hdDesc );
}
catch (err)
{
removeHistory = true;
}
toneAdjuster.convert32(); // This is a no-op if the conversion cancelled
}

if ((app.documents.length > 0) && this.askFlatten() && this.askRGB())
{
var depthMap = {'BitsPerChannelType.EIGHT': 8, 'BitsPerChannelType.SIXTEEN': 16, 'BitsPerChannelType.THIRTYTWO': 16};
var resultDepth = depthMap[app.activeDocument.bitsPerChannel];
var was32 = app.activeDocument.bitsPerChannel == BitsPerChannelType.THIRTYTWO;
// Group the convert to & from into a single operation
if (was32)
app.activeDocument.suspendHistory(localize("$$$/HDRToning/HDR_Tone_State_name=HDR Toning"),
"doConversion32()");
else
// Group the convert up to 32 and convert down into a single operation
app.activeDocument.suspendHistory(localize("$$$/HDRToning/HDR_Tone_State_name=HDR Toning"),
"doConversionNon32()");

// If the operation was canceled, remove the history state
if (removeHistory)
//killLastHistoryState();
}
}

toneAdjuster.doAdjustment();
Photo of Jeffrey Tranberry

Jeffrey Tranberry, Sr. Product Manager, Digital Imaging

  • 14147 Posts
  • 1765 Reply Likes
Excellent. Thanks.
Photo of Matt Molloy

Matt Molloy

  • 6 Posts
  • 1 Reply Like
Happy to help!