home *** CD-ROM | disk | FTP | other *** search
Wrap
from JascApp import * import JascUtils # 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 Sharpen. def ScriptProperties(): return { 'Author': 'Kris Zaklika', 'Copyright': 'Copyright (C) 2002-2003, Jasc Software Inc., All Rights Reserved. Permission to create derivate works of this script is granted provided this copyright notice is included', '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): # 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.true, 'Strength': 30, 'Temperature': 6000, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, '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.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } }) # Clarify the image App.Do( Environment, 'Clarify', { 'Strength': 2, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, '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.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } }) # Smooth the image while preserving edge information App.Do( Environment, 'EdgePreservingSmooth', { 'SmoothingFactor': 2, 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } }) # Sharpen the image App.Do( Environment, 'Sharpen', { 'GeneralSettings': { 'ExecutionMode': App.Constants.ExecutionMode.Silent, 'AutoActionMode': App.Constants.AutoActionMode.Match } })