Prep Newspaper Excerpt

Moderator: Kathy_9

Post Reply
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Prep Newspaper Excerpt

Post by Rick_R »

SEE THE "VERSION 2" SECTION. It works a lot better than the original scripts.

This prepares a multi-layer copy of a full-page newspaper article that will be excerpted.

The output file does get very large. A 4500 x 6200 jpg 4MB on disk, 27MB in RAM saves as a 65MB pspimage and 224MB in RAM (yes, 1/4 GB). Once you crop the image you'll definitely want to delete the bottom "Original" layer.

Let's say the article you want to show is in the bottom 2 inches.
Page before excerpting
Page before excerpting

After the user does all edits, the result will be the page top, a divider, a levels adjustment layer, and a little more than the bottom 2 inches.
Sample after full editing
Sample after full editing
The user must put the divider image in the clipboard. I have an image with two black wavy lines with white between them.
Example excerpt page divider
Example excerpt page divider
The script does not crop anything, it just does the prep work.
Layers the script creates (plus star)
Layers the script creates (plus star)
TASK: EXCERPT NEWSPAPER ARTICLE

1) Keeps page top
2) User positions user-defined divider image layer that indicates "removed"
3) The two bottom image layers are hidden
4) In the remaining VISIBLE image user erases everything BELOW divider
5) User makes next-to-bottom [NTB] image visible
6) User moves NTB up to only show BELOW the divider image the part
that will remain, i.e., if article is at bottom quarter, move up
so TOP of article is just BELOW divider. When moving up, it should
"slide under" the PAGE TOP *and* divider.
7a) User crops to the visible area and saves. -- OR --
7b) User selects the visible area, copies, pastes, saves as new image.

User can then edit the image, e.g., using the Levels layer to reduce
gray discoloration.

ACTIONS PERFORMED BY THE SCRIPT

Promote background to layer
Hide layer
Duplicate layer - this will be the visible article
Hide layer
Duplicate layer - this will be the visible top above the divider
Add Levels Adjustment layer
Paste as new layer the (divider) IMAGE currently in the clipboard
Move that up NEAR the top
Save as .pspimage with "cr-" PREFIX and FULL original name FOLLOWED by
".pspimage" (cr- means "cropped") e.g. cr-MyFile 04.jpg.pspimage

Code: Select all

from PSPApp import *

    # TASK: EXCERPT NEWSPAPER ARTICLE 
    #
    # 1) Keeps page top
    # 2) User positions user-defined divider image layer that indicates "removed"
    # 3) The two bottom image layers are hidden
    # 4) In the remaining VISIBLE image user erases everything BELOW divider
    # 5) User makes next-to-bottom [NTB] image visible
    # 6) User moves NTB up to only show BELOW the divider image the part
    #    that will remain, i.e., if article is at bottom quarter, move up
    #    so TOP of article is just BELOW divider.  When moving up, it should
    #    "slide under" the PAGE TOP *and* divider.
    # 7a) User crops to the visible area and saves. -- OR --
    # 7b) User selects the visible area, copies, pastes, saves as new image.
    #
    # User can then edit the image, e.g., using the Levels layer to reduce
    # gray discoloration.
    #
    # ACTIONS PERFORMED BY THE SCRIPT
    #
    # Promote background to layer
    # Hide layer
    # Duplicate layer - this will be the visible article
    # Hide layer
    # Duplicate layer - this will be the visible top above the divider
    # Add Levels Adjustment layer
    # Paste as new layer the (divider) IMAGE currently in the clipboard
    # Move that up NEAR the top
    # Save as .pspimage with "cr-" PREFIX and FULL original name FOLLOWED by
    # ".pspimage"  (cr- means "cropped") e.g. cr-MyFile 04.jpg.pspimage

def ScriptProperties():
    return {
        'Author': u'Joseph Rick Reinckens',
        'Copyright': u'no',
        'Description': u'Add adjustment and wavy lines layers to news article, for excerpting',
        'Host': u'PaintShop Pro',
        'Host Version': u'19.00'
        }

def Do(Environment):
    path = App.TargetDocument.Name.rstrip(App.TargetDocument.Title)
    filename = path + "cr-" + App.TargetDocument.Title + ".pspimage"

    # EnableOptimizedScriptUndo
    App.Do( Environment, 'EnableOptimizedScriptUndo', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

    # ORIGINAL
    # LayerPromoteBackground
    App.Do( Environment, 'LayerPromoteBackground', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Original'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Original', 
                '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': ((19,0,0),1)
                }
            })


    # HIDE ORIGINAL IMAGE
    # LayerSetVisibility
    App.Do( Environment, 'LayerSetVisibility', {
            'Command': App.Constants.ShowCommands.Hide, 
            'Path': None, 
            'WorkingMode': 1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                'AutoActionMode': App.Constants.AutoActionMode.Default, 
                'Version': ((19,0,0),1)
                }
            })

    # ARTICLE
    # LayerDuplicate
    App.Do( Environment, 'LayerDuplicate', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Article'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Article', 
                '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': ((19,0,0),1)
                }
            })

    # PAGE TOP
    # LayerDuplicate
    App.Do( Environment, 'LayerDuplicate', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Page Top'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Page Top', 
                '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': ((19,0,0),1)
                }
            })

    # LayerSetVisibility
    App.Do( Environment, 'LayerSetVisibility', {
            'Command': App.Constants.ShowCommands.Show, 
            'Path': None, 
            'WorkingMode': 1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                'AutoActionMode': App.Constants.AutoActionMode.Default, 
                'Version': ((19,0,0),1)
                }
            })

    # ADD A LEVELS ADJUSTMENT LAYER because newspaper articles
    # routinely get "greyed"
    # Levels
    App.Do( Environment, 'NewAdjustmentLayerLevels', {
            'General': {
                'Opacity': 100, 
                'Name': u'Levels 1', 
                'IsVisible': True, 
                'IsTransparencyLocked': False, 
                'LinkSet': 0, 
                'UseHighlight': False, 
                'PaletteHighlightColor': (255,255,64), 
                'GroupLink': True, 
                'BlendMode': App.Constants.BlendMode.Normal
                }, 
            'EffectLayer_Root': {
                'WorkingMode': 0
                }, 
            'Levels': {
                'RGB': (0,223,1.00648,0,255), 
                'Red': (0,255,1,0,255), 
                'Green': (0,255,1,0,255), 
                'Blue': (0,255,1,0,255), 
                'Clipping': 0
                }, 
            'Overlay': {
                'Color': (255,0,0), 
                'Opacity': 50
                }, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # PASTE AS NEW LAYER THE "SEPARATOR" IMAGE ALREADY IN THE CLIPBOARD
    # PasteAsNewLayer
    App.Do( Environment, 'PasteAsNewLayer', {
            'CreateFromDropData': False, 
            'InsertPos': -1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

			
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Separator', 
                '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': ((19,0,0),1)
                }
            })

    # MOVE THE SEPARATOR NEAR THE PAGE TOP
    # Move
    App.Do( Environment, 'Mover', {
            'Offset': (41,-2139), 
            'Object': App.Constants.LayerOrSelection.Layer, 
            'SelectPoint': (2143.5,3150.5), 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

    # SAVE AS PSP IMAGE WITH NEW NAME
    # FileSaveAs
    App.Do( Environment, 'FileSaveAs', {
            'Encoding': {
                'PSP': {
                    'Compression': App.Constants.PspCompression.LZ77, 
                    'Version': App.Constants.PspVersion.PSP18, 
                    'EmbedICC': False
                    }
                }, 
            'FileName': filename, 
            'FileFormat': App.Constants.FileFormat.PSP, 
            'FormatDesc': u'PSPIMAGE', 
            'WorkingMode': 0, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'DialogPlacement': {
                    'ShowMaximized': False, 
                    'Rect': ((0,0), 0, 0)
                    }, 
                'AutoActionMode': App.Constants.AutoActionMode.AllAlways, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }, 
            'DefaultProperties': []
            })

Last edited by Rick_R on Tue Jun 12, 2018 4:02 am, edited 3 times in total.
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Prep Newspaper Excerpt

Post by Rick_R »

By the way, not to be gruesome--I'm doing genealogy about my aunt, who was killed in the car accident in the example. I put the script together because there are a lot of articles. (I don't think I ever met her, and if I did I would have been less than 8 years old.)
Last edited by Rick_R on Wed Jun 06, 2018 2:59 am, edited 1 time in total.
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Prep Newspaper Excerpt

Post by Rick_R »

Here's the same thing for running as a batch process. It doesn't save or rename the file.

Code: Select all

from PSPApp import *

    # TASK: EXCERPT NEWSPAPER ARTICLE 
    #
    # 1) Keeps page top
    # 2) User positions user-defined divider image layer that indicates "removed"
    # 3) The two bottom image layers are hidden
    # 4) In the remaining VISIBLE image user erases everything BELOW divider
    # 5) User makes next-to-bottom [NTB] image visible
    # 6) User moves NTB up to only show BELOW the divider image the part
    #    that will remain, i.e., if article is at bottom quarter, move up
    #    so TOP of article is just BELOW divider.  When moving up, it should
    #    "slide under" the PAGE TOP *and* divider.
    # 7a) User crops to the visible area and saves. -- OR --
    # 7b) User selects the visible area, copies, pastes, saves as new image.
    #
    # User can then edit the image, e.g., using the Levels layer to reduce
    # gray discoloration.
    #
    # ACTIONS PERFORMED BY THE SCRIPT
    #
    # Promote background to layer
    # Hide layer
    # Duplicate layer - this will be the visible article
    # Hide layer
    # Duplicate layer - this will be the visible top above the divider
    # Add Levels Adjustment layer
    # Paste as new layer the (divider) IMAGE currently in the clipboard
    # Move that up NEAR the top

def ScriptProperties():
    return {
        'Author': u'Joseph Rick Reinckens',
        'Copyright': u'no',
        'Description': u'Add adjustment and wavy lines layers to news article, for excerpting',
        'Host': u'PaintShop Pro',
        'Host Version': u'19.00'
        }

def Do(Environment):
    # Not used - only run this script as a batch
    path = App.TargetDocument.Name.rstrip(App.TargetDocument.Title)
    filename = path + "cr-" + App.TargetDocument.Title + ".pspimage"

    # EnableOptimizedScriptUndo
    App.Do( Environment, 'EnableOptimizedScriptUndo', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

    # ORIGINAL
    # LayerPromoteBackground
    App.Do( Environment, 'LayerPromoteBackground', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Original'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Original', 
                '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': ((19,0,0),1)
                }
            })

    # HIDE ORIGINAL IMAGE
    # LayerSetVisibility
    App.Do( Environment, 'LayerSetVisibility', {
            'Command': App.Constants.ShowCommands.Hide, 
            'Path': None, 
            'WorkingMode': 1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                'AutoActionMode': App.Constants.AutoActionMode.Default, 
                'Version': ((19,0,0),1)
                }
            })

    # ARTICLE
    # LayerDuplicate
    App.Do( Environment, 'LayerDuplicate', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Article'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Article', 
                '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': ((19,0,0),1)
                }
            })

    # PAGE TOP
    # LayerDuplicate
    App.Do( Environment, 'LayerDuplicate', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Page Top'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Page Top', 
                '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': ((19,0,0),1)
                }
            })

    # LayerSetVisibility
    App.Do( Environment, 'LayerSetVisibility', {
            'Command': App.Constants.ShowCommands.Show, 
            'Path': None, 
            'WorkingMode': 1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                'AutoActionMode': App.Constants.AutoActionMode.Default, 
                'Version': ((19,0,0),1)
                }
            })

    # ADD A LEVELS ADJUSTMENT LAYER because newspaper articles
    # routinely get "greyed"
    # Levels
    App.Do( Environment, 'NewAdjustmentLayerLevels', {
            'General': {
                'Opacity': 100, 
                'Name': u'Levels 1', 
                'IsVisible': True, 
                'IsTransparencyLocked': False, 
                'LinkSet': 0, 
                'UseHighlight': False, 
                'PaletteHighlightColor': (255,255,64), 
                'GroupLink': True, 
                'BlendMode': App.Constants.BlendMode.Normal
                }, 
            'EffectLayer_Root': {
                'WorkingMode': 0
                }, 
            'Levels': {
                'RGB': (0,223,1.00648,0,255), 
                'Red': (0,255,1,0,255), 
                'Green': (0,255,1,0,255), 
                'Blue': (0,255,1,0,255), 
                'Clipping': 0
                }, 
            'Overlay': {
                'Color': (255,0,0), 
                'Opacity': 50
                }, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # PASTE AS NEW LAYER THE "SEPARATOR" IMAGE ALREADY IN THE CLIPBOARD
    # PasteAsNewLayer
    App.Do( Environment, 'PasteAsNewLayer', {
            'CreateFromDropData': False, 
            'InsertPos': -1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

			
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Separator', 
                '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': ((19,0,0),1)
                }
            })

    # MOVE THE SEPARATOR NEAR THE PAGE TOP
    # Move
    App.Do( Environment, 'Mover', {
            'Offset': (41,-2139), 
            'Object': App.Constants.LayerOrSelection.Layer, 
            'SelectPoint': (2143.5,3150.5), 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Prep Newspaper Excerpt

Post by Rick_R »

Although "this was working yesterday", "today" I'm running into a problem that although it's creating the layers in the correct sequence, before the "move" it is making Page Top the active layer, so it winds up moving that instead of the separator.

I've tried programmatically switching to a different layer but it's not working. So I had to delete the "move" step near the end.
Last edited by Rick_R on Thu Jun 07, 2018 4:45 am, edited 1 time in total.
LeviFiction
Advisor
Posts: 6831
Joined: Thu Oct 02, 2008 1:07 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Alienware M17xR4
processor: Intel Core i7-3630QM CPU - 2_40GH
ram: 6 GB
Video Card: NVIDIA GeForce GTX 660M
sound_card: Sound Blaster Recon3Di
Hard_Drive_Capacity: 500GB
Corel programs: PSP: 8-2023
Location: USA

Re: Prep Newspaper Excerpt

Post by LeviFiction »

The Scripting For Script Author's PDF has an entire section on selecting specific layers.

I think the problem you are seeing is because of the fact that Mover will move whatever layer is underneath the tool at the time not the layer that's selected. The command selects a very specific spot, and if that spot is not on the visible portions of the layer you have selected it'll grab the layer that is visible in that area. So if your article is at a different size each time you will probably see this.

The way to fix this is to change the "SelectPoint" parameter to None. Right now it's set to (2143.5, 3150.5). Change it to None. Example below.

Code: Select all

    # Move
    App.Do( Environment, 'Mover', {
            'Offset': (41,-2139),
            'Object': App.Constants.LayerOrSelection.Layer,
            'SelectPoint': None,
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default,
                'AutoActionMode': App.Constants.AutoActionMode.Match,
                'Version': ((9,0,0),1),
                'PreviewMode': 1,
                'ScreenControl': 1
                }
            })
Another important thing is the Offset. This offset will always move the layer 41 pixels to the right, and 2139 pixels upward. So if your image is not at minimum 4,278 pixels tall it will probably end up off of the image.
https://levifiction.wordpress.com/
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Prep Newspaper Excerpt

Post by Rick_R »

VERSION 2
(now that I found out how to create masked adjustment layers)

TWO SCRIPTS

Excerpting a Newspaper Article

Overview: With a newspaper page, put a divider below the top (e.g., the name of the paper, etc.), move up the section with the desired article, separately "un-gray" the sections above and below the divider.

Actions:

CREATE THE IMAGE LAYERS

1) Open the Layers palete (F8)
2) Load the divider image into the clipboard.
(Usually, the divider should be wavy, a sawblade pattern, or something else that obviously isn't part of the original page.)
3) Open the image to be excerpted.
4) Run the script: Prep News Excerpt.PSPScript

EDIT THE PAGE TOP IMAGE

5) Select Move tool.
6) Position the divider.
7) Select Page Top layer.
8) Select All.
9) Select the Selection tool
Selection type: Rectangle
Mode: Replace
10) Set the Page Top bottom (In Selection Tool Options click to left of "Create selection from")
11) Invert selection.
12) Delete key.
This should delete almost everything below the divider.
13) Select None.

CLEAN UP THE EDITED PAGE TOP

14) Make sure you're still in the Page Top layer.
15) If there is Page Top image below the divider, select Eraser tool.
(This occurs when your divider doesn't have a horizontal bottom.)
16) Using Eraser, delete any Page Top image below the divider.
17) Switch to Selection tool.
(Just so you don't erase anything accidentally.)

CREATE 2 MASKED LEVEL ADJUSTMENTS LAYERS

18) Select the Page Top layer.
19) Put the cursor in the visible Page Top area.

20) Run script: Adjust News Excerpt Levels.PspScript
This creates and renames two masked Levels Adjustment layers, one for Page Top and one for Article.

21) If you prefer, move the Article Level Adj layer from above Page Top layer to above Article layer.
(This isn't necessary. Because of the mask, each Level Adj layer will only affect its part.)

MOVE THE ARTICLE UP

22) Make Article layer visible.
23) Hide the Article Level Adj layer.
(If you don't, when you try to move the Article layer, PSP automatically switches to the adjustment layer instead.)
24) Select the Article layer.
25) Select Move tool.
26) Move the article up. It will slide "under" Page Top.

CROP IMAGE AND SAVE

27) Select the part you want to keep, and Crop to Selection.
28) Delete layer Original.
29) Save the cropped image.

"UN-GRAY" PAGE TOP AND ARTICLE

30) Turn on the Article Level Adj layer.
31) Use the Levels Adj layers to fix the Page Top and Article layers.

Hint: Because you're keeping the entire horizontal section containing the article, it's generally a good idea to add a large star or arrow near the article. Putting a box is generally not a good idea because newspapers routinely do that.
Layers created by Version 2 with two masked adjustment layers.
Layers created by Version 2 with two masked adjustment layers.
Last edited by Rick_R on Tue Jun 12, 2018 4:17 am, edited 1 time in total.
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Prep Newspaper Excerpt

Post by Rick_R »

Prep News Excerpt.PSPScript

Code: Select all

from PSPApp import *

    # TASK: EXCERPT NEWSPAPER ARTICLE 
    #
    # 1) Keeps page top
    # 2) User positions user-defined divider image layer that indicates "removed"
    # 3) The two bottom image layers are hidden
    # 4) In the remaining VISIBLE image user erases everything BELOW divider
    # 5) User makes next-to-bottom [NTB] image visible
    # 6) User moves NTB up to only show BELOW the divider image the part
    #    that will remain, i.e., if article is at bottom quarter, move up
    #    so TOP of article is just BELOW divider.  When moving up, it should
    #    "slide under" the PAGE TOP *and* divider.
    # 7a) User crops to the visible area and saves. -- OR --
    # 7b) User selects the visible area, copies, pastes, saves as new image.
    #
    # User can then edit the image, e.g., using the Levels layer to reduce
    # gray discoloration.
    #
    # ACTIONS PERFORMED BY THE SCRIPT
    #
    # Promote background to layer
    # Hide layer
    # Rename layer to "Original"
    # Duplicate layer - this will be the visible article
    # Hide layer
    # Rename layer to "Article"
    # Duplicate layer - this will be the visible top above the divider
    # Rename layer to "Article"
    # Paste as new layer the (divider) IMAGE currently in the clipboard
    #   NOTE: the script DOES crash if there is no IMAGE in the clipboard.
    # Save as .pspimage with "cr-" PREFIX and FULL original name FOLLOWED by
    # ".pspimage"  (cr- means "cropped") e.g. cr-MyFile 04.jpg.pspimage

def ScriptProperties():
    return {
        'Author': u'Joseph Rick Reinckens',
        'Copyright': u'no',
        'Description': u'Add adjustment and wavy lines layers to news article, for excerpting',
        'Host': u'PaintShop Pro',
        'Host Version': u'19.00'
        }

def Do(Environment):
    path = App.TargetDocument.Name.rstrip(App.TargetDocument.Title)
    filename = path + "cr-" + App.TargetDocument.Title + ".pspimage"

    # EnableOptimizedScriptUndo
    App.Do( Environment, 'EnableOptimizedScriptUndo', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

    # ORIGINAL
    # LayerPromoteBackground
    App.Do( Environment, 'LayerPromoteBackground', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Original'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Original', 
                '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': ((19,0,0),1)
                }
            })


    # HIDE ORIGINAL IMAGE
    # LayerSetVisibility
    App.Do( Environment, 'LayerSetVisibility', {
            'Command': App.Constants.ShowCommands.Hide, 
            'Path': None, 
            'WorkingMode': 1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                'AutoActionMode': App.Constants.AutoActionMode.Default, 
                'Version': ((19,0,0),1)
                }
            })

    # ARTICLE
    # LayerDuplicate
    App.Do( Environment, 'LayerDuplicate', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Article'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Article', 
                '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': ((19,0,0),1)
                }
            })

    # PAGE TOP
    # LayerDuplicate
    App.Do( Environment, 'LayerDuplicate', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # RENAME TO 'Page Top'
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Page Top', 
                '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': ((19,0,0),1)
                }
            })

    # LayerSetVisibility
    App.Do( Environment, 'LayerSetVisibility', {
            'Command': App.Constants.ShowCommands.Show, 
            'Path': None, 
            'WorkingMode': 1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                'AutoActionMode': App.Constants.AutoActionMode.Default, 
                'Version': ((19,0,0),1)
                }
            })

    # PASTE AS NEW LAYER THE "SEPARATOR" IMAGE ALREADY IN THE CLIPBOARD
    # PasteAsNewLayer
    App.Do( Environment, 'PasteAsNewLayer', {
            'CreateFromDropData': False, 
            'InsertPos': -1, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }
            })

			
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Separator', 
                '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': ((19,0,0),1)
                }
            })

    # SAVE AS PSP IMAGE WITH NEW NAME
    # FileSaveAs
    App.Do( Environment, 'FileSaveAs', {
            'Encoding': {
                'PSP': {
                    'Compression': App.Constants.PspCompression.LZ77, 
                    'Version': App.Constants.PspVersion.PSP18, 
                    'EmbedICC': False
                    }
                }, 
            'FileName': filename, 
            'FileFormat': App.Constants.FileFormat.PSP, 
            'FormatDesc': u'PSPIMAGE', 
            'WorkingMode': 0, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'DialogPlacement': {
                    'ShowMaximized': False, 
                    'Rect': ((0,0), 0, 0)
                    }, 
                'AutoActionMode': App.Constants.AutoActionMode.AllAlways, 
                'Version': ((19,0,0),1), 
                'PreviewMode': 1, 
                'ScreenControl': 1
                }, 
            'DefaultProperties': []
            })
Rick_R
Posts: 194
Joined: Sat Sep 24, 2011 5:20 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK Computer INC F2A85-V Pro
processor: AMD A6-6400K APU
ram: 8GB
Video Card: PowerColor AMD Radeon R7 240 2GB DDR3
sound_card: On-board Realtek and AMD High Definition Audio
Hard_Drive_Capacity: 16TB+375GB
Monitor/Display Make & Model: SEIKI SE39UY04 39in 4K UHD TV
Corel programs: PaintShop Pro 12-2022 Ultimate
Location: Dallas, Texas USA

Re: Prep Newspaper Excerpt

Post by Rick_R »

Adjust News Excerpt Levels.PspScript

Code: Select all

from PSPApp import *

def ScriptProperties():
    return {
        'Author': u'Joseph Rick Reinckens',
        'Copyright': u'none',
        'Description': u'Creates two masked Levels adjustments layers, one for what is visible and one for what is not.',
        'Host': u'PaintShop Pro',
        'Host Version': u'19.00'
        }

def Do(Environment):
    # EnableOptimizedScriptUndo
    App.Do( Environment, 'EnableOptimizedScriptUndo', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # Magic Wand
    App.Do( Environment, 'MagicWand', {
            'General': {
                'Mode': App.Constants.SelectionOperation.Replace, 
                'Antialias': True, 
                'Feather': 0, 
                'SampleMerged': False
                }, 
            'MatchMode': App.Constants.MatchMode.AllOpaque, 
            'Contiguous': True, 
            'Point': (1935.5,225.5), 
            'Tolerance': 4, 
            'AntialiasType': App.Constants.AntialiasType.Outside, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # This is so the Page Top layer will come above the Article layer
    # SelectInvert
    App.Do( Environment, 'SelectInvert', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # Article Levels Adjustment Layer
    # Levels
    App.Do( Environment, 'NewAdjustmentLayerLevels', {
            'General': {
                'Opacity': 100, 
                'Name': u'Levels 2', 
                'IsVisible': True, 
                'IsTransparencyLocked': False, 
                'LinkSet': 0, 
                'UseHighlight': False, 
                'PaletteHighlightColor': (255,255,64), 
                'GroupLink': True, 
                'BlendMode': App.Constants.BlendMode.Normal
                }, 
            'EffectLayer_Root': {
                'WorkingMode': 0
                }, 
            'Levels': {
                'RGB': (0,255,1,0,255), 
                'Red': (0,255,1,0,255), 
                'Green': (0,255,1,0,255), 
                'Blue': (0,255,1,0,255), 
                'Clipping': 0
                }, 
            'Overlay': {
                'Color': (255,0,0), 
                'Opacity': 50
                }, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # Rename the Article levels Adjust layer
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Article Level Adj', 
                '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': ((19,0,0),1)
                }
            })

    # Invert so Page Top layer comes above
    # SelectInvert
    App.Do( Environment, 'SelectInvert', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # Page Top Levels Adjustment Layer
    # Levels
    App.Do( Environment, 'NewAdjustmentLayerLevels', {
            'General': {
                'Opacity': 100, 
                'Name': u'Levels 2', 
                'IsVisible': True, 
                'IsTransparencyLocked': False, 
                'LinkSet': 0, 
                'UseHighlight': False, 
                'PaletteHighlightColor': (255,255,64), 
                'GroupLink': True, 
                'BlendMode': App.Constants.BlendMode.Normal
                }, 
            'EffectLayer_Root': {
                'WorkingMode': 0
                }, 
            'Levels': {
                'RGB': (0,255,1,0,255), 
                'Red': (0,255,1,0,255), 
                'Green': (0,255,1,0,255), 
                'Blue': (0,255,1,0,255), 
                'Clipping': 0
                }, 
            'Overlay': {
                'Color': (255,0,0), 
                'Opacity': 50
                }, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })

    # Rename the page top levels Adjust layer
    # Layer Properties
    App.Do( Environment, 'LayerProperties', {
            'General': {
                'Opacity': None, 
                'Name': u'Page Top Level Adj', 
                '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': ((19,0,0),1)
                }
            })

    # SelectNone
    App.Do( Environment, 'SelectNone', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((19,0,0),1)
                }
            })
Post Reply