Applying script on loaded pic different to batch processing?

Moderator: Kathy_9

Post Reply
pstein
Posts: 110
Joined: Wed Dec 28, 2011 7:09 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP X2
Location: Germany/Canada

Applying script on loaded pic different to batch processing?

Post by pstein »

Once again I experienced a strange result in script execution:

At first I loaded a photo *.jpg image with a size of 2072 kb into PSP and executed the script (shown at the bottom) directly from script toolbar.

The script is simple: Just resize, saturate, sharp and save

The result is a file of size 1455 KB.
Fine so far.

Now I went in PSP to menu File-->Batch process, then browsed to a copy of the original *.jpg photo file, then selected
the mentioned script from the drop-down and finally clicked on "Start" button.

Much to my surprise the resulting file has only a size of only 493 KB!

Why? Shouldn't it be the same resulting file size as direct execution for loaded pic?

Does Batch processing of a script use another compression factor as processing for loaded pictures?

Is there a way to set the compression factor as function directly in script file?

Thank you
Peter

Code: Select all

from PSPApp import *

def ScriptProperties():
    return {
        'Author': u'',
        'Copyright': u'',
        'Description': u'',
        'Host': u'Paint Shop Pro Photo',
        'Host Version': u'12.01'
        }

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

    # Resize
    App.Do( Environment, 'Resize', {
            'AspectRatio': 1.33333, 
            'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels, 
            'CurrentResolutionUnits': App.Constants.ResolutionUnits.PixelsPerIn, 
            'Height': 1440, 
            'MaintainAspectRatio': True, 
            'Resample': True, 
            'ResampleType': App.Constants.ResampleType.Bicubic, 
            'ResizeAllLayers': True, 
            'Resolution': 300, 
            'Width': 1920, 
            'SharpnessValue': 50, 
            'AdvancedMode': True, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((12,0,1),1)
                }
            })

    # Color Adjust HSL
    App.Do( Environment, 'ColorAdjustHSL', {
            'HSL': {
                'Colorize': False, 
                'Master': (0,12,0), 
                'MasterColorize': (0,0,0), 
                'Red': (0,0,0,315,345,15,45), 
                'Green': (0,0,0,75,105,135,165), 
                'Blue': (0,0,0,195,225,255,285), 
                'Cyan': (0,0,0,135,165,195,225), 
                'Magenta': (0,0,0,255,285,315,345), 
                'Yellow': (0,0,0,15,45,75,105)
                }, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((12,0,1),1)
                }
            })

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

    # FileSave
    App.Do( Environment, 'FileSave', {
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.AllAlways, 
                'Version': ((12,0,1),1)
                }, 
            'DefaultProperties': []
            })

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: Applying script on loaded pic different to batch process

Post by LeviFiction »

Don't use a script that saves the file in a batch process. The batch process command handles the saving for you. There should be an option in the output settings to set the save parameters including the compression level.
https://levifiction.wordpress.com/
pstein
Posts: 110
Joined: Wed Dec 28, 2011 7:09 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PSP X2
Location: Germany/Canada

Re: Applying script on loaded pic different to batch process

Post by pstein »

LeviFiction wrote:There should be an option in the output settings to set the save parameters including the compression level.
Hmm, where do I find this option EXACTLY?
I found neither one in dialog when saving the just recorded script nor in the batch process dialog.
See attached snapshots.

How can I specify the compression factor manually/textually in script file?

Peter
2019-07-04 15_39_05-Save As.png
2019-07-04 15_40_18-Batch Process.png
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: Applying script on loaded pic different to batch process

Post by LeviFiction »

Why you want to overwrite and destroy your originals I will never understand.

To manually set the compression of a batch without using a script
1) Select New Type
2) Choose JPG inType
3) Hit Options - Set Compression
4) Leave everything else blank it'll overwrite.

IF you must use a script to do the saving, use Save As to set the compression in the script and set Batch Process to Script Save. NOT Overwrite.

1) When recording the script use Save As and set the compression level
2) Open the script in a text editor
3) Edit the script and change the FileName parameter to be App.TargetDocument.Name
4) Save the script
5) Open Batch Process
6) Set Use Script and Silent Mode
7) Set Script Save
8) Add Images and run batch

The script will do the saving, SaveAs will set the compression, and using App.TargetDocument.Name will overwrite the image by using the full image path. And since it's run in silent mode it won't ask for permission.

Here is an example of the SaveAs command set with a compression level of 8, and using App.TargetDocument.Name as the filename

Code: Select all

    # FileSaveAs
    App.Do( Environment, 'FileSaveAs', {
            'Encoding': {
                'JPG': {
                    'Variant': App.Constants.JpegFormat.Standard, 
                    'CompressionFactor': 8, 
                    'ChromaSubSampling': App.Constants.ChromaSubSampling.YCC_1x1_1x1_1x1, 
                    'EXIF': True, 
                    'EmbedJPGICC': True
                    }
                }, 
            'FileName': App.TargetDocument.Name, 
            'FileFormat': App.Constants.FileFormat.JPG, 
            'FormatDesc': u'JPG JPEG ', 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.AllAlways, 
                'Version': ((12,5,0),1)
                }, 
            'DefaultProperties': []
            })
https://levifiction.wordpress.com/
Post Reply