This is Interesting: Free Magazines for Graphics designers and webmasters  


Home > Archive > Paint Shop Pro support > September 2004 > One-Step-Photo-Fix Script in Interactive Mode (with DCNR alternative)





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author One-Step-Photo-Fix Script in Interactive Mode (with DCNR alternative)
GregGatts

2004-09-24, 12:22 pm

I noticed some discussion on the OSPF (One-Step Photo Fix) script, those that
like it, those that don't. And sometimes Jasc's own defaults fail miserably. Not
many people like to get into the inner-workings and edit their own scripts, I
thought I'd try to help out those people.

Below is the OSPF script with edits to make it interactive so you can see what
it is doing at each step and adjust them manually if need be. If you don't like
it doing anything at one step just hit cancel, then agree to run the rest of the
script when the alert pops up. I also changed sharpen to unsharp-mask. When it
opens up the adjustment windows check to make sure that you like the default
settings that I embedded in the script. If not, edit the script to make it into
your favorite defaults for each adjustment made. Now that you have the DCNR
(Digital Camera Noise Removal) filter in PSP9 you might want to replace the
edge-preserving-smooth with that, if you have some favorite settings that work
the best with the majority of your photos. An example of DCNR script that you
could inside of the OSPF script is already included here below the new script.

(The easiest way I found to add modules for scripts, is to just record one short
script using your favorite tool and settings for it then save it. Copy those
results into the script of your choice (but edit out any position settings and
constants it might record). Then copy and paste that section into the script of
your choice.)

Reasons I changed some of default OSPF settings: I found that the "remove color
cast" option in auto-color-balance would often destroy a sunset or overcast
feeling that I wanted to retain in a photo, or other images with a strong and
important ambient light source. So I turned that off, it ruined things more
times than fixing things. Since I do a lot of nature photography I didn't care
for the skin-tone preservation in auto-saturation I turned off that option too.
Your needs may vary, edit accordingly.

Those not familiar with hand-editing scripts, just change the "...Boolean.false"
to "...Boolean.true" for those setting options that you'd like to toggle back
on.

Just copy and paste the below script into any text editor and save it under the
name of something like "OSPF_Interactive.PspScript" and put it in your
scripts-restricted or scripts-trusted folder

------copy from below this line-------
# This script provides "one-step" photo enhancement by running the
# following commands in order: Automatic Color Balance, Automatic
# Contrast Enhancement, Clarify, Automatic Saturation Enhancement,
# Edge Preserving Smooth and Un-Sharp-Mask.

def ScriptProperties():
return {
'Description': 'One-Step Photo Correction',
'Host': 'Paint Shop Pro 8',
'Host Version': '8.00'
}

# Get the image information for the current image

def Do(Environment):
App.Do( Environment, 'EnableOptimizedScriptUndo' )

# we need a document for this to work
if JascUtils.RequireADoc( Environment ) == App.Constants.Boolean.false:
return

# make the image true color if it is not already there
JascUtils.PromoteToTrueColor( Environment, App.TargetDocument )

# a number of operations are done differently on greyscale - capture that state
GreyScale = JascUtils.IsGreyScale( Environment, App.TargetDocument )

# Color balance the image if it is not greyscale

if not GreyScale:
App.Do( Environment, 'AutoColorBalance', {
'RemoveColorCast': App.Constants.Boolean.false,
'Strength': 30,
'Temperature': 6500,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

# Enhance the contrast

App.Do( Environment, 'AutoContrastEnhancement', {
'Appearance': App.Constants.Appearance.Natural,
'Bias': App.Constants.ContrastBias.Neutral,
'Strength': App.Constants.ContrastStrength.Normal,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

# Enhance the saturation if the image is not greyscale

if not GreyScale:
App.Do( Environment, 'AutoSaturationEnhancement', {
'Bias': App.Constants.SaturationBias.Normal,
'Skintones': App.Constants.Boolean.false,
'Strength': App.Constants.SaturationStrength.Normal,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

# Smooth the image while preserving edge information

App.Do( Environment, 'EdgePreservingSmooth', {
'SmoothingFactor': 2,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

# Unsharp Mask
App.Do( Environment, 'UnsharpMask', {
'Clipping': 2,
'Radius': 1.66,
'Strength': 65,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'PreviewVisible': App.Constants.Boolean.true,
'AutoProof': App.Constants.Boolean.false,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

------end script--------------------------------


Here's an example of a noise removal script with some okay settings for PSP v9.0
that you could use to replace the edge-preserving-smooth filter in the above
script. Just delete the "Edge Preserving Smooth" section in the above script and
copy/insert this section in the same place:



# Digital Camera Noise Removal
App.Do( Environment, 'DigitalCameraNoiseRemoval', {
'SmallDetails': 30,
'MediumDetails': 30,
'LargeDetails': 30,
'Blending': 45,
'Sharpening': 1,
'LockDetailSettings': True,
'Hue': 39,
'Range': 70,
'MinimalLuminance': 4,
'MaximalLuminance': 255,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Interactive,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((9,0,0),1)
}
})


Mike Williams

2004-09-24, 7:18 pm

Wasn't it GregGatts who wrote:
>I noticed some discussion on the OSPF (One-Step Photo Fix) script, those that
>like it, those that don't. And sometimes Jasc's own defaults fail miserably. Not
>many people like to get into the inner-workings and edit their own scripts, I
>thought I'd try to help out those people.


I found that I had to add the following two lines to the start of the
script to get it to work (I'm using PSP 8.10)

from JascApp import *
import JascUtils


Personally I run several modified versions of One-Step Photo Fix without
interactivity. I find that the Jasc defaults for most of the operations
work together well, but the result can often be way too strong. So what
I do is get the script to duplicate the layer and apply the changes to
the new layer. When the effect is too strong, I F8 the layer palette and
reduce the opacity value of the new layer. This goes after the greyscale
test, before any of the actual enhancements get applied.

App.Do( Environment, 'LayerDuplicate', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Match
}
})

I also remove the Automatic Colour Balance from all my modified copies
of OSPF, because I often want to have images that have an overall colour
tone to them.

--
Mike Williams
Gentleman of Leisure
GregGatts

2004-09-24, 11:21 pm

Ah, thanks for catching that. It happened when I was editing out a bunch of
juvenile ego-crap from the original script before posting it. In my haste I left
out those 2 lines.



On Fri, 24 Sep 2004 13:35:34 +0100, Mike Williams <nospam@econym.demon.co.uk>
wrote:

>Wasn't it GregGatts who wrote:
>
>I found that I had to add the following two lines to the start of the
>script to get it to work (I'm using PSP 8.10)
>
>from JascApp import *
>import JascUtils
>
>
>Personally I run several modified versions of One-Step Photo Fix without
>interactivity. I find that the Jasc defaults for most of the operations
>work together well, but the result can often be way too strong. So what
>I do is get the script to duplicate the layer and apply the changes to
>the new layer. When the effect is too strong, I F8 the layer palette and
>reduce the opacity value of the new layer. This goes after the greyscale
>test, before any of the actual enhancements get applied.
>
> App.Do( Environment, 'LayerDuplicate', {
> 'GeneralSettings': {
> 'ExecutionMode': App.Constants.ExecutionMode.Silent,
> 'AutoActionMode': App.Constants.AutoActionMode.Match
> }
> })
>
>I also remove the Automatic Colour Balance from all my modified copies
>of OSPF, because I often want to have images that have an overall colour
>tone to them.


Sponsored Links


Copyright 2003 - 2008 forum4designers.com  Software forum  Computer Hardware reviews