RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
Randlov
Posts: 10
Joined: Mon Aug 01, 2016 2:43 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Lenovo ThinkPad T550
processor: Intel Core i7-5600U
ram: 16GB
Video Card: Inte HD Graphics 5500
sound_card: Realtek High Definition Audio
Hard_Drive_Capacity: 3513GB
Monitor/Display Make & Model: Lenovo. 15.5" 3K, IPSW, Multi-touch
Corel programs: PaintShop Pro X7 and X8 32/64 2019 2021

RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by Randlov »

I have a large number of scans in 600 dpi with varying dimensions which I want to reduce to 300 dpi in a batch process. With a single image “Resize/By Print Size” does the job, but what are the settings for a batch process?
I just want the resolution changed from 600 to 300 and nothing else changed.
Best regards
Peter
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: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by LeviFiction »

What version of PSP are you using?

Versions X7, X8, and X9 have a revamped batch process which allows you to use the resize dialog use Resize By Print Size the same way you do a regular image. Naturally, you'll want to make sure it's making copies of the images and not overwriting the originals in case I'm wrong but I don't think I am.

The other option, which should work in all versions of PSP, is to use a resize script that's been edited to work with all images. I've actually got a script for just this purpose somewhere, it may be at home.

If you're confident in editing scripts yourself or just copying one into notepad you can use this code. Just copy this into Notepad and save into your Scripts-Restricted folder make sure the file extension is "PSPScript" name it whatever you want. I'll be posting actual scripts into the scripting section later today.

But just add scripting to your batch process, and use this script. It'll be fine.

For those interested in manually editing such a script. I recorded the resize and saved it as a script. Then I went in and changed the "Width" parameter to equal "App.TargetDocument.Width" and did the same with the height. And changed the Aspect Ratio parameter to "App.TargetDocument.Width/App.TargetDocument.Height" this way the image will always remain the same size, it's only the resolution that changes.

Code: Select all

from PSPApp import *

def ScriptProperties():
    return {
        'Author': u'',
        'Copyright': u'',
        'Description': u'',
        'Host': u'PaintShop Pro',
        'Host Version': u'9.00'
        }

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

    # Resize
    App.Do( Environment, 'Resize', {
            'AspectRatio': App.TargetDocument.Width/App.TargetDocument.Height, 
            'CurrentDimensionUnits': App.Constants.UnitsOfMeasure.Pixels, 
            'CurrentResolutionUnits': App.Constants.ResolutionUnits.PixelsPerIn, 
            'Height': App.TargetDocument.Height, 
            'MaintainAspectRatio': True, 
            'Resample': True, 
            'ResampleType': App.Constants.ResampleType.Bicubic, 
            'ResizeAllLayers': True, 
            'Resolution': 300, 
            'Width': App.TargetDocument.Width, 
            'SharpnessValue': 50, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((9,0,0),1)
                }
            })
https://levifiction.wordpress.com/
Randlov
Posts: 10
Joined: Mon Aug 01, 2016 2:43 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Lenovo ThinkPad T550
processor: Intel Core i7-5600U
ram: 16GB
Video Card: Inte HD Graphics 5500
sound_card: Realtek High Definition Audio
Hard_Drive_Capacity: 3513GB
Monitor/Display Make & Model: Lenovo. 15.5" 3K, IPSW, Multi-touch
Corel programs: PaintShop Pro X7 and X8 32/64 2019 2021

Re: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by Randlov »

Thank you LeviFiction
Your script works all right and changes from 600 to 300 dpi, but the height and width in mm is doubled (whereas the height and width in pixels are maintained).
Is there a command like App.TagetDocument.Width where the physical width (in mm) and not the width in pixels is addressed?
Regards
Peter
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: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by LeviFiction »

So you want to resize the image to keep the current print size? That requires more work. Not a huge amount of work but enough.
I do have a script at home that will do that. Will post it later in the scripting section.
https://levifiction.wordpress.com/
JoeB
Posts: 2778
Joined: Fri Mar 28, 2008 10:04 pm
operating_system: Windows 8.1
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: LENOVO 4524PE4 ThinkCentre M91p
processor: 3.10 gigahertz Intel Quad Core i5-2400
ram: 8 GB
Hard_Drive_Capacity: 4.6 TB
Corel programs: PSP 9, X7 to 2019, 32 & 64-bit
Location: Canada

Re: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by JoeB »

And while you're waiting for Levifiction to post the new scripts, you should look at line 26 of the script he posted, which reads as follows:

'CurrentResolutionUnits': App.Constants.ResolutionUnits.PixelsPerIn

As you can see at the end of that line, the script changes the PPI (Pixels Per Inch), not DPI (Dots Per Inch). No graphic program can change DPI because that is a function of the printer and its associated software/driver. Graphic programs can only adjust the PPI of an image. That PPI information is embedded in the image information. You cannot embed DPI information in an image because, as stated, that's a printer function.
Regards,

JoeB
Using PSP 2019 64bit
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: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by LeviFiction »

Okay I have posted the scripts here see if that works for you.

http://forum.corel.com/EN/viewtopic.php ... 45#p334045
https://levifiction.wordpress.com/
Randlov
Posts: 10
Joined: Mon Aug 01, 2016 2:43 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Lenovo ThinkPad T550
processor: Intel Core i7-5600U
ram: 16GB
Video Card: Inte HD Graphics 5500
sound_card: Realtek High Definition Audio
Hard_Drive_Capacity: 3513GB
Monitor/Display Make & Model: Lenovo. 15.5" 3K, IPSW, Multi-touch
Corel programs: PaintShop Pro X7 and X8 32/64 2019 2021

Re: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by Randlov »

Thank you again for the two scripts, which I tried right away.
Actually, the two scripts do the same as the first, they change the resolution to the default resolution (300 ppi - I am learning :-), but doubled the dimensions.
However, after seeing that you can do math with variables in the script I tried to replace App.TargetDocument.Height with App.TargetDocument.Height/2 (same for Width) and that worked.
In few minutes I had almost 2000 files converted the way I want.
Now I will experiment a little with the scripts. Replacing the factor 2 with the ratio App.Constants.ResolutionUnits.PixelsPerIn / 300 or the code for default resolution should do the trick?
Thanks a lot for your help, it saved me much work now and in the future.
Best regards
Peter
Randlov
Posts: 10
Joined: Mon Aug 01, 2016 2:43 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Lenovo ThinkPad T550
processor: Intel Core i7-5600U
ram: 16GB
Video Card: Inte HD Graphics 5500
sound_card: Realtek High Definition Audio
Hard_Drive_Capacity: 3513GB
Monitor/Display Make & Model: Lenovo. 15.5" 3K, IPSW, Multi-touch
Corel programs: PaintShop Pro X7 and X8 32/64 2019 2021

Re: RESIZE FROM 600 TO 300 DPI IN BATCH PROCESS

Post by Randlov »

Hello again
Sorry, I was too fast, I tried ChangeResolutionAndResample once again, and it does exactly as promised.
The resolution is changed to default (300 ppi in my case), and Height and Width are unchanged, just as I wanted.
Thanks
Peter
Post Reply