Place many images in a destination image

Moderator: Kathy_9

Post Reply
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Place many images in a destination image

Post by Jean-Luc »

This is a feature lacking in PSP.
I want to insert images into another, automatically. I'll rearrange them later.

Suppose I have 3 different images open on the workspace.
The fourth image is a background image where I want to put the others.
I cannot select all the images in one time and put them as new layers into the fourth.
I need to do it manually for each: click on the first image, do Ctrl + C, click on the fourth image (destination) and do Ctrl +V.
See the video : http://screencast.com/t/lDmD48Cnl6MR
It is very painfull if I have lot of images to place on different backgrounds.

Could it be done by a script ?

The steps :
- we suppose all images are open on the workspace
- click on the destination image to put the focus on it (= the target)
- from there, run a script putting the focus on the successive images, Ctrl+C, return to the destination image, Ctrl+V
- stops when all images (except the destination image) are copied in the destination image

If it helps : successive images could be closed after copying. Number of images may vary.

In other softwares (Word, Publisher, CorelDraw), we can select multiple images and put them in one operation inside the workspace.
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
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: Place many images in a destination image

Post by LeviFiction »

Yes, this can be done in a script and very easily....unless one of the images you want to have copied over has multiple layers.

Cassel and I have a "OpenAsLayer" script that opens as many new images as you want and after opening them, copies them as new layers onto the target image. It then closes the images that you opened with the script.

But, if you already have the images open in the workspace then the script would look something like this.

Code: Select all

from PSPApp import *

def ScriptProperties():
    return {
        'Author': u'LeviFiction',
        'Copyright': u'',
        'Description': "Copy all opened documents onto the target",
        'Host': u'Corel PaintShop Pro',
        'Host Version': u'9.00'
        }
        
def Do(Environment):
    TDoc = App.TargetDocument
    DocList = App.Documents
    for doc in DocList:
        if TDoc.Title == doc.Title and TDoc.Name == doc.Name:
            continue  #Document is target document, skip it
        else:
            # Copy
            App.Do( Environment, 'Copy', {
                    'GeneralSettings': {
                        'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                        'AutoActionMode': App.Constants.AutoActionMode.Match, 
                        'Version': ((9,0,0),1)
                        }
                    },doc)
            # PasteAsNewLayer
            App.Do( Environment, 'PasteAsNewLayer', {
                    'CreateFromDropData': False, 
                    'InsertPos': -1, 
                    'GeneralSettings': {
                        'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                        'AutoActionMode': App.Constants.AutoActionMode.Match, 
                        'Version': ((9,0,0),1)
                        }
                    }, TDoc)
            #FileClose
            App.Do( Environment, 'FileClose', {
                    'GeneralSettings': {
                        'ExecutionMode': App.Constants.ExecutionMode.Silent, 
                        'AutoActionMode': App.Constants.AutoActionMode.Match,
                        'Version': ((9,0,0),1)
                        }
                    },
                    doc)

So as you can see, what this does is it first creates variables to hold the current document list, and the target document. Then it filters through the list, for each document in the DocList it checks to see if it's the target document. If it is, it skips that document. Otherwise, it copies the document, pastes it as a new layer, the closes the document.

By setting the last parameter of any App.Do() command to equal a document object we can force PSP to use that function on that document and not the active document. So no need to make successive calls to "SelectDocument"
https://levifiction.wordpress.com/
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Place many images in a destination image

Post by Jean-Luc »

Wonderful !

It is exactly what I wanted.

This may help an user on the French group and for my own use also.
It is interesting to see that scripts may complete the lacking features of PSP. :)

Thank you !
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
Post Reply