home *** CD-ROM | disk | FTP | other *** search
/ PC Extra 07 & 08 / pca1507.iso / Software / psp8 / Data1.cab / OneStepPhotoFix.PspScript < prev    next >
Encoding:
Text File  |  2003-04-22  |  3.6 KB  |  97 lines

  1. from JascApp import *
  2. import JascUtils
  3.  
  4. # This script provides "one-step" photo enhancement by running the
  5. # following commands in order: Automatic Color Balance, Automatic
  6. # Contrast Enhancement, Clarify, Automatic Saturation Enhancement,
  7. # Edge Preserving Smooth and Sharpen.
  8.  
  9. def ScriptProperties():
  10.     return {
  11.         'Author': 'Kris Zaklika',
  12.         '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',
  13.         'Description': 'One-Step Photo Correction',
  14.         'Host': 'Paint Shop Pro 8',
  15.         'Host Version': '8.00'
  16.         }
  17.  
  18. # Get the image information for the current image
  19.  
  20. def Do(Environment):
  21. # we need a document for this to work
  22.     if JascUtils.RequireADoc( Environment ) == App.Constants.Boolean.false:
  23.         return
  24.  
  25. # make the image true color if it is not already there
  26.     JascUtils.PromoteToTrueColor( Environment, App.TargetDocument )
  27.  
  28. # a number of operations are done differently on greyscale - capture that state
  29.     GreyScale = JascUtils.IsGreyScale( Environment, App.TargetDocument )
  30.     
  31. # Color balance the image if it is not greyscale
  32.  
  33.     if not GreyScale:
  34.         App.Do( Environment, 'AutoColorBalance', {
  35.                 'RemoveColorCast': App.Constants.Boolean.true, 
  36.                 'Strength': 30, 
  37.                 'Temperature': 6000, 
  38.                 'GeneralSettings': {
  39.                     'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  40.                     'AutoActionMode': App.Constants.AutoActionMode.Match
  41.                     }
  42.                 })
  43.  
  44. # Enhance the contrast
  45.     
  46.     App.Do( Environment, 'AutoContrastEnhancement', {
  47.             'Appearance': App.Constants.Appearance.Natural, 
  48.             'Bias': App.Constants.ContrastBias.Neutral, 
  49.             'Strength': App.Constants.ContrastStrength.Normal, 
  50.             'GeneralSettings': {
  51.                 'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  52.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  53.                 }
  54.             })
  55.  
  56. # Clarify the image
  57.  
  58.     App.Do( Environment, 'Clarify', {
  59.             'Strength': 2, 
  60.             'GeneralSettings': {
  61.                 'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  62.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  63.                 }
  64.             })
  65.  
  66. # Enhance the saturation if the image is not greyscale
  67.  
  68.     if not GreyScale:
  69.         App.Do( Environment, 'AutoSaturationEnhancement', {
  70.                 'Bias': App.Constants.SaturationBias.Normal, 
  71.                 'Skintones': App.Constants.Boolean.false, 
  72.                 'Strength': App.Constants.SaturationStrength.Normal, 
  73.                 'GeneralSettings': {
  74.                     'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  75.                     'AutoActionMode': App.Constants.AutoActionMode.Match
  76.                     }
  77.                 })
  78.  
  79. # Smooth the image while preserving edge information
  80.  
  81.     App.Do( Environment, 'EdgePreservingSmooth', {
  82.             'SmoothingFactor': 2, 
  83.             'GeneralSettings': {
  84.                 'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  85.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  86.                 }
  87.             })
  88.  
  89. # Sharpen the image
  90.  
  91.     App.Do( Environment, 'Sharpen', {
  92.             'GeneralSettings': {
  93.                 'ExecutionMode': App.Constants.ExecutionMode.Silent, 
  94.                 'AutoActionMode': App.Constants.AutoActionMode.Match
  95.                 }
  96.             })
  97.