In case some members of the forum find usefulness in it, here is the script I recorded - it seems to do what I had in mind and what I understand as luminosity masks. If you check it out and have suggestions, comments, tips, etc I'd be grateful.
UPDATE:
I didn't encounter "jaggies" with the first two images I edited using my first script, but I did with subsequent images. This makes it clear to me that Gimp and PSP work a bit differently as far as layers go. LeviFiction (thanks!) asked about this, and pointed out that it might occur. As a result I've revised this script by removing Threshold. I would still welcome any comments/suggestions/improvements, as this script helps but still doesn't quite seem to give me luminosity masking as in Gimp.
My script was recorded and saved in my restricted scripts folder (DriveLetter:\Users\UserName\Documents\Corel PaintShop Pro\18.0\Scripts-Restricted):
Code: Select all
from PSPApp import *
def ScriptProperties():
return {
'Author': u'gbotes',
'Copyright': u'',
'Description': u'Create light, dark and mid tone masks for editi'\
u'ng with curves',
'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)
}
})
# LayerDuplicate
App.Do( Environment, 'LayerDuplicate', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Layer Properties
App.Do( Environment, 'LayerProperties', {
'General': {
'Opacity': None,
'Name': u'Dark',
'IsVisible': None,
'IsTransparencyLocked': None,
'LinkSet': None,
'UseHighlight': None,
'PaletteHighlightColor': None,
'GroupLink': None,
'BlendMode': None
},
'BlendRanges': None,
'Path': (0,0,[],False),
'ArtMediaTexture': None,
'Effects': None,
'BrightnessContrast': None,
'ChannelMixer': None,
'ColorBalance': None,
'CurveParams': None,
'HSL': None,
'Threshold': None,
'Levels': None,
'Posterize': None,
'Vibrancy': None,
'Overlay': None,
'LocalToneMapping': None,
'Invert': None,
'HistogramAdjustment': None,
'FillLightClarity': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# LayerDuplicate
App.Do( Environment, 'LayerDuplicate', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Layer Properties
App.Do( Environment, 'LayerProperties', {
'General': {
'Opacity': None,
'Name': u'Light',
'IsVisible': None,
'IsTransparencyLocked': None,
'LinkSet': None,
'UseHighlight': None,
'PaletteHighlightColor': None,
'GroupLink': None,
'BlendMode': None
},
'BlendRanges': None,
'Path': (0,0,[],False),
'ArtMediaTexture': None,
'Effects': None,
'BrightnessContrast': None,
'ChannelMixer': None,
'ColorBalance': None,
'CurveParams': None,
'HSL': None,
'Threshold': None,
'Levels': None,
'Posterize': None,
'Vibrancy': None,
'Overlay': None,
'LocalToneMapping': None,
'Invert': None,
'HistogramAdjustment': None,
'FillLightClarity': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# LayerDuplicate
App.Do( Environment, 'LayerDuplicate', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Layer Properties
App.Do( Environment, 'LayerProperties', {
'General': {
'Opacity': None,
'Name': u'Mid',
'IsVisible': None,
'IsTransparencyLocked': None,
'LinkSet': None,
'UseHighlight': None,
'PaletteHighlightColor': None,
'GroupLink': None,
'BlendMode': None
},
'BlendRanges': None,
'Path': (0,0,[],False),
'ArtMediaTexture': None,
'Effects': None,
'BrightnessContrast': None,
'ChannelMixer': None,
'ColorBalance': None,
'CurveParams': None,
'HSL': None,
'Threshold': None,
'Levels': None,
'Posterize': None,
'Vibrancy': None,
'Overlay': None,
'LocalToneMapping': None,
'Invert': None,
'HistogramAdjustment': None,
'FillLightClarity': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# MaskFromImage
App.Do( Environment, 'MaskFromImage', {
'CreateMaskFrom': App.Constants.CreateMaskFrom.Luminance,
'InvertMaskData': False,
'SourceImage': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,-1,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# MaskFromImage
App.Do( Environment, 'MaskFromImage', {
'CreateMaskFrom': App.Constants.CreateMaskFrom.Luminance,
'InvertMaskData': False,
'SourceImage': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,-1,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# MaskFromImage
App.Do( Environment, 'MaskFromImage', {
'CreateMaskFrom': App.Constants.CreateMaskFrom.Luminance,
'InvertMaskData': True,
'SourceImage': 0,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,1,[2],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,-1,[2],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# Copy
App.Do( Environment, 'Copy', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,2,[1],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# PasteAsNewLayer
App.Do( Environment, 'PasteAsNewLayer', {
'CreateFromDropData': False,
'InsertPos': -1,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,-1,[2],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# Copy
App.Do( Environment, 'Copy', {
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (1,1,[2],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# PasteAsNewLayer
App.Do( Environment, 'PasteAsNewLayer', {
'CreateFromDropData': False,
'InsertPos': -1,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# LayerMergeDown
App.Do( Environment, 'LayerMergeDown', {
'Path': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Vector Selection Update
App.Do( Environment, 'VectorSelectionUpdate', {
'Path': (0,1,[],False),
'Type': App.Constants.ObjectSelection.Select,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
# DeleteLayer
App.Do( Environment, 'DeleteLayer', {
'Path': None,
'MergeMask': False,
'WorkingMode': 1,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((18,0,0),1)
}
})
# Layer Properties
App.Do( Environment, 'LayerProperties', {
'General': {
'Opacity': None,
'Name': u'Mask - Mid',
'IsVisible': None,
'IsTransparencyLocked': None,
'LinkSet': None,
'UseHighlight': None,
'PaletteHighlightColor': None,
'GroupLink': None,
'BlendMode': None
},
'BlendRanges': None,
'Path': (0,0,[],False),
'ArtMediaTexture': None,
'Effects': None,
'BrightnessContrast': None,
'ChannelMixer': None,
'ColorBalance': None,
'CurveParams': None,
'HSL': None,
'Threshold': None,
'Levels': None,
'Posterize': None,
'Vibrancy': None,
'Overlay': None,
'LocalToneMapping': None,
'Invert': None,
'HistogramAdjustment': None,
'FillLightClarity': None,
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Silent,
'AutoActionMode': App.Constants.AutoActionMode.Default,
'Version': ((18,0,0),1)
}
})
