How to script "Auto Levels"

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
mbourla
Posts: 3
Joined: Tue Oct 07, 2014 9:04 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit

How to script "Auto Levels"

Post by mbourla »

I want to create a script that automates the command Adjust > Brightness and Contrast > Levels, where I would normally click on the 3 buttons in the Auto box (Contrast, Color and Levels). If I record a script, it seems to capture the values for that particular photo. Whereas I want the script to simulate me clicking the "auto" buttons and so apply the correct levels for each photo it runs on. Does anyone know how to do that in a script?

I can tell it's not correct because if I try it on a variety of photos, the results are different if I do the commands manually vs running the script.

Below is the part of the script that recorded the command I wanted. You can see it's got hard-coded values for the Red/Green/Blue levels etc, and isn't actually working them out for the photo it's being run on.

I'm using PSP X6 (64 bit) but I'm sure the question would apply to any version.

I really need to find out how to do this, so would really value any help or advice. I'm told Photoshop can do it, so I'm sure there must be some way to do it in Paintshop Pro.

Thanks
Michael

# Color Adjust Levels
App.Do( Environment, 'ColorAdjustLevels', {
'Levels': {
'RGB': (6,255,1.00581,0,255),
'Red': (0,255,1,0,255),
'Green': (0,255,1,0,255),
'Blue': (0,255,1,0,255),
'Clipping': 0
},
'GeneralSettings': {
'ExecutionMode': App.Constants.ExecutionMode.Default,
'AutoActionMode': App.Constants.AutoActionMode.Match,
'Version': ((16,0,0),1)
}
})
Tadjio
Posts: 1202
Joined: Fri Mar 28, 2008 3:23 pm
operating_system: Windows 8 Pro
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte
processor: Core i7 2.8GHz 860
ram: 8GB
Video Card: ATI HD5570
sound_card: Sound
Hard_Drive_Capacity: 2.5TB
Location: UK

Re: How to script "Auto Levels"

Post by Tadjio »

What I have done, and you can do, is to edit the script to the 'default' colour settings:-

'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
},

Then you run the script and press one of the buttons e.g. 'Levels'

This works well form me as the last step in a series doing HighPassSharpen, Clarify and ColorAdjustFillLightClarity.
Tadjio
PSP X7.2 Ultimate user
AfterShot Pro 2.1 ASPirant
Windows 8.1 64-bit Pro
Canon EOS 100D, Olympus E-PM1 & iPhone 6
mbourla
Posts: 3
Joined: Tue Oct 07, 2014 9:04 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit

Re: How to script "Auto Levels"

Post by mbourla »

Many thanks for the quick reply - I'll give that a try. What I was really after is a way to script the "auto levels" so I can batch process a set of images using that script, to do the auto contrast/color/levels on each one automatically. Do you know how to do that?

Regards
Michael
Tadjio
Posts: 1202
Joined: Fri Mar 28, 2008 3:23 pm
operating_system: Windows 8 Pro
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte
processor: Core i7 2.8GHz 860
ram: 8GB
Video Card: ATI HD5570
sound_card: Sound
Hard_Drive_Capacity: 2.5TB
Location: UK

Re: How to script "Auto Levels"

Post by Tadjio »

mbourla wrote:Many thanks for the quick reply - I'll give that a try. What I was really after is a way to script the "auto levels" so I can batch process a set of images using that script, to do the auto contrast/color/levels on each one automatically. Do you know how to do that?
Regards
Michael
You can't! :cry:
Tadjio
PSP X7.2 Ultimate user
AfterShot Pro 2.1 ASPirant
Windows 8.1 64-bit Pro
Canon EOS 100D, Olympus E-PM1 & iPhone 6
mbourla
Posts: 3
Joined: Tue Oct 07, 2014 9:04 pm
operating_system: Windows 7 Professional
System_Drive: C
32bit or 64bit: 64 Bit

Re: How to script "Auto Levels"

Post by mbourla »

That's not what I was hoping to hear :( . I'll just have to use a script but press the buttons each time for each photo. Not the end of the world I suppose. Thanks again for your help.
Tadjio
Posts: 1202
Joined: Fri Mar 28, 2008 3:23 pm
operating_system: Windows 8 Pro
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte
processor: Core i7 2.8GHz 860
ram: 8GB
Video Card: ATI HD5570
sound_card: Sound
Hard_Drive_Capacity: 2.5TB
Location: UK

Re: How to script "Auto Levels"

Post by Tadjio »

mbourla wrote:That's not what I was hoping to hear :( . I'll just have to use a script but press the buttons each time for each photo. Not the end of the world I suppose. Thanks again for your help.
Believe me, I did try too. Now I am just happy to press the buttons each time... :?
Tadjio
PSP X7.2 Ultimate user
AfterShot Pro 2.1 ASPirant
Windows 8.1 64-bit Pro
Canon EOS 100D, Olympus E-PM1 & iPhone 6
Tadjio
Posts: 1202
Joined: Fri Mar 28, 2008 3:23 pm
operating_system: Windows 8 Pro
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte
processor: Core i7 2.8GHz 860
ram: 8GB
Video Card: ATI HD5570
sound_card: Sound
Hard_Drive_Capacity: 2.5TB
Location: UK

Re: How to script "Auto Levels"

Post by Tadjio »

Two further thoughts about "Auto Levels":-

1) I set the Levels "Options" Histogram Clipping to the minimum possible i.e. 0.01% (Lower and Upper Levels) and the Strength to 100%
This ensures minimal clipping when you press "Auto Levels".

2) You can use the Control Key when sliding the Highlights and Shadows sliders in order to see Technicolor Clipping Warning.
This really helps to see where "Auto Levels" will affect the image.
Tadjio
PSP X7.2 Ultimate user
AfterShot Pro 2.1 ASPirant
Windows 8.1 64-bit Pro
Canon EOS 100D, Olympus E-PM1 & iPhone 6
Post Reply