The purpose of this script is to handle the donkey work of my basic image processing. It does some auto-corrections and sharpening, and saves the image in color, black and white, and sepia. IMPORTANT: For this script to work, if anybody is interested in trying it, you need to create a folder "C:\Photography" and then three more sub-folders within it as follows: "1-Colour", "2-Black and White" and "3-Sepia".
I attach a screenshot of how I configure the output settings for batch processing. The script needs to run from your "Scripts-Trusted" folder. UPDATE: 28 Oct 2015 - thanks to LeviFiction's assistance, my RAM usage issue with batch processing using this script has been resolved. It was traced to FileSaveAs. Simply changing FileSaveAs to FileSave resolved the matter. I've posted a revised script below which is working brilliantly for me, in case other forum members run into a similar issue or can use the script. I'm sure there are better ways to script this, but it will take me some time to learn all I need to know about PSP scripting.
Code: Select all
from PSPApp import *
def ScriptProperties():
return {
'Author': u'',
'Copyright': u'',
'Description': u'',
'Host': u'PaintShop Pro',
'Host Version': u'18.00'
}
def Do(Environment):
# EnableOptimizedScriptUndo
App.Do( Environment, 'EnableOptimizedScriptUndo', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# OneStepPhotoFix
App.Do( Environment, 'OneStepPhotoFix', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# HighPassSharpen
App.Do( Environment, 'HighPassSharpen', {
'BlendMode': App.Constants.BlendMode.SoftLight,
'Strength': 70,
'Radius': 10,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# FileSave
App.Do( Environment, 'FileSave', {
'Encoding': {
'JPG': {
'Variant': App.Constants.JpegFormat.Standard,
'CompressionFactor': 20,
'ChromaSubSampling': App.Constants.ChromaSubSampling.YCC_1x1_1x1_1x1,
'EXIF': True,
'EmbedJPGICC': True
}
},
'FileName': u'C:\\Photography\\1-Colour\\' + App.TargetDocument.Title,
'FileFormat': App.Constants.FileFormat.JPG,
'FormatDesc': u'JPG JPEG ',
'WorkingMode': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((18,0,0),1)
},
'DefaultProperties': []
})
# BlackAndWhiteFilm
App.Do( Environment, 'BlackAndWhiteFilm', {
'FilterColor': None,
'Strength': None,
'Red': 0.3333,
'Green': 0.3333,
'Blue': 0.3333,
'Brightness': 0,
'Clarify': 0,
'SuggestSettings': False,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vignette
App.Do( Environment, 'Vignette', {
'Amount': 19,
'Fog': -88,
'Feather': 25,
'Selection': [(0.0789561,0.09),(0.921044,0.87075)],
'SelectionMode': 2,
'InvertSelection': False,
'DiffuseGlow': 10,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# FileSave
App.Do( Environment, 'FileSave', {
'Encoding': {
'JPG': {
'Variant': App.Constants.JpegFormat.Standard,
'CompressionFactor': 20,
'ChromaSubSampling': App.Constants.ChromaSubSampling.YCC_1x1_1x1_1x1,
'EXIF': True,
'EmbedJPGICC': True
}
},
'FileName': u'C:\\Photography\\2-Black and White\\' + App.TargetDocument.Title,
'FileFormat': App.Constants.FileFormat.JPG,
'FormatDesc': u'JPG JPEG ',
'WorkingMode': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((18,0,0),1)
},
'DefaultProperties': []
})
# New Raster Layer
App.Do( Environment, 'NewRasterLayer', {
'General': {
'Opacity': 100,
'Name': u'Raster 1',
'IsVisible': True,
'IsTransparencyLocked': False,
'LinkSet': 0,
'UseHighlight': False,
'PaletteHighlightColor': (255,255,64),
'GroupLink': True,
'BlendMode': App.Constants.BlendMode.Normal
},
'BlendRanges': {
'BlendRangeGreen': (0,0,255,255,0,0,255,255),
'BlendRangeRed': (0,0,255,255,0,0,255,255),
'BlendRangeBlue': (0,0,255,255,0,0,255,255),
'BlendRangeGrey': (0,0,255,255,0,0,255,255)
},
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Fill
App.Do( Environment, 'Fill', {
'BlendMode': App.Constants.BlendMode.Darken,
'MatchMode': App.Constants.MatchMode.None,
'Material': {
'Color': (128,80,12),
'Pattern': None,
'Gradient': None,
'Texture': None,
'Art': None
},
'UseForeground': True,
'Opacity': 100,
'Point': (1590.5,1975.5),
'SampleMerged': True,
'Tolerance': 20,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# MultiObjectProperties
App.Do( Environment, 'MultiObjectProperties', {
'General': {
'Opacity': None,
'Name': None,
'IsVisible': None,
'IsTransparencyLocked': None,
'LinkSet': None,
'UseHighlight': None,
'PaletteHighlightColor': None,
'GroupLink': None,
'BlendMode': App.Constants.BlendMode.SoftLight
},
'Effects': None,
'WorkingMode': 1,
'Path': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((18,0,0),1)
}
})
# MultiObjectProperties
App.Do( Environment, 'MultiObjectProperties', {
'General': {
'Opacity': 80,
'Name': None,
'IsVisible': None,
'IsTransparencyLocked': None,
'LinkSet': None,
'UseHighlight': None,
'PaletteHighlightColor': None,
'GroupLink': None,
'BlendMode': None
},
'Effects': None,
'WorkingMode': 1,
'Path': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((18,0,0),1)
}
})
# FileSave
App.Do( Environment, 'FileSave', {
'Encoding': {
'JPG': {
'Variant': App.Constants.JpegFormat.Standard,
'CompressionFactor': 20,
'ChromaSubSampling': App.Constants.ChromaSubSampling.YCC_1x1_1x1_1x1,
'EXIF': True,
'EmbedJPGICC': True
}
},
'FileName': u'C:\\Photography\\3-Sepia\\' + App.TargetDocument.Title,
'FileFormat': App.Constants.FileFormat.JPG,
'FormatDesc': u'JPG JPEG ',
'WorkingMode': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.AllAlways,
'Version': ((18,0,0),1)
},
'DefaultProperties': []
})
# FileClose - probably not needed, but included just in case!
App.Do( Environment, 'FileClose', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
