Resizing script

Moderator: Kathy_9

leahcimi
Posts: 106
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL
Location: SE Cornwall

Resizing script

Post by leahcimi »

I am using the modfied Nik sript to run Akvis Frames but Frames not only adds a frame but the image it saves is larger than the original so that when imported back into PSP, the frame is not seen.
I need to add within the script a section to resize the Frames saved image to the same dimensions as the original.
Any ideas?
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: Resizing script

Post by LeviFiction »

Do you want to resize the imported image, or do you want to increase the canvas size of the original to match the new image size?

Both are do-able. Keep in mind that if the frame added by Akvis Frames makes the image have a different aspect ratio then it'll appear slightly squished upon resize.

So there are several ways to potentially handle this. For example what you can do is before the "PasteAsNewLayer" command use a "SelectAll" command and change "PasteAsNewLayer" to "PasteIntoSelection". This will force the paste into the dimensions of the selection which should include the whole canvas. It will also overwrite the currently selected layer instead of adding in a new layer.

If you're not sure how to make these commands, you can use the history palette to do the hard work for you. Here is a quick silent video on that: https://drive.google.com/file/d/1MRBTab ... 5vhLi/view

Another option would be, after the image has been pasted as a new layer you can use either Resize Canvas or just Resize. These require a bit more work an manipulation of parameters but it's doable. Resize Canvas is for growing the original image to match the new layer size. And Resize can be used to target a single layer and resize it down to the size you want.

Essentially for these other two options you need to get the LayerProperties so you know how big the layer is. With Resize Canvas you just need to know the new width and height, and make sure that it's set to keep the current image in the center.

Code: Select all

    rect = App.Do(Environment, 'ReturnLayerProperties', {})['LayerRect']
    #rect[1] = Width
    #rect[2] = Height

    # ResizeCanvas
    App.Do( Environment, 'ResizeCanvas', {
            'FillColor': (255,255,255), 
            'HoriPlace': App.Constants.HorizontalType.Center, 
            'MaintainAspect': False, 
            'NewDimUnits': App.Constants.UnitsOfMeasure.Pixels, 
            'NewHeight': rect[2],   #*
            'NewWidth': rect[1],      #*
            'VertPlace': App.Constants.VerticalType.Center, 
            'GeneralSettings': {
                'ExecutionMode': App.Constants.ExecutionMode.Default, 
                'AutoActionMode': App.Constants.AutoActionMode.Match, 
                'Version': ((20,0,0),1)
                }
            })
The resize command is a bit messier, I won't go into it. I personally think those are your two best bets. I could be wrong, there could be a better method out there.
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: Resizing script

Post by JoeB »

Unfortunately Akvis Frames does change the aspect ratio of the original image. Unless there is some reason to do otherwise, I would suggest simply editing the script to only have it return the framed image as a new image rather than as a layer on the original image.
Regards,

JoeB
Using PSP 2019 64bit
leahcimi
Posts: 106
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL
Location: SE Cornwall

Re: Resizing script

Post by leahcimi »

I have come to the same conclusion as JoeB and decided to return the framed image as a new image rather than as a layer on the original image.
Thanks for your thoughts too LeviFiction.
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: Resizing script

Post by JoeB »

leahcimi wrote:I have come to the same conclusion as JoeB and decided to return the framed image as a new image rather than as a layer on the original image.
Thanks for your thoughts too LeviFiction.
I did the same thing with a script I have for DXO Viewpoint, because once you do a perspective correction you will always get a cropped/resized result which doesn't do anything to enhance the original image as a layer. So it might as well be an image on its own. :-)

But I'm glad LeviFiction got back to you with his ideas, because I can see them being useful for other scripts that I might want to try out. You might also want to hang on to his suggestions for possible future use!
Regards,

JoeB
Using PSP 2019 64bit
leahcimi
Posts: 106
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL
Location: SE Cornwall

Re: Resizing script

Post by leahcimi »

I have found a rather convoluted way to use Akvis Frames directly in PSP:
Run Akvis Frames without a selected image. Select the frame you want and save it as a default PNG. Open the PNG in PSP, make white areas transparent (you have to promote the background layer to do this) and save as a PspImage. Rename that PspImage file as a PspFrame and copy it to the frames folder.
Seems to work!
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: Resizing script

Post by JoeB »

leahcimi wrote:I have found a rather convoluted way to use Akvis Frames directly in PSP:
Run Akvis Frames without a selected image. Select the frame you want and save it as a default PNG. Open the PNG in PSP, make white areas transparent (you have to promote the background layer to do this) and save as a PspImage. Rename that PspImage file as a PspFrame and copy it to the frames folder.
Seems to work!
Good thinking, and it works well. Of course, if you have the original AKVIS frame pack plus the free additional pack you've go around 50 frames or more so it's a bit of a chore if you want to convert them all. :-) However, once done then using the frames within PSP has the advantage that it will allow using portrait orientation frames on landscape orientation pictures and vice versa, PSP maintains an aspect ratio much closer to that of the original image, frame can be made to show more of the image by using the outside/inside picture options, and of course the other frame options are also available. AKVIS frames is pretty basic and you simply don't have any of those options. So if you do much framing and like the frames in AKVIS then, in the end, it does pay to convert them for use within PSP as pspframe images.

By the way, you don't have to save as .pspimage first and then rename. Use the Save As pspimage dialogue but just name it .pspframe and save it in your Frames folder.

Also, if you create a folder and copy the frames zip files from wherever you have them and then unzip them, you'll find each comes with a mask. While the .png images are just small images the masks are the same size as the frames you're saving from AKVIS. You can rename the mask images by just removing the .mask extension and then open them in PSP along with the matching frame you saved from AKVIS. The mask will show - in black - the actual area of the frame it is supposed to cover, so by making a magic wand selection of the mask you can make sure you get all of the stuff that's supposed to be transparent. Then save that selection to Alpha channel, put the frame image into focus and load the selection then hit Delete. With some of the frames it can give you a more accurate transparency to the frame, although I'm sure that with many - if not most - of the frames it wouldn't really be necessary to get every little bit to make the frame look good. So that's just a suggestion that might not really matter. :-)

To speed up the process if you do go that route, you can always add the Save Selection to Alpha and Load Selection to Alpha commands to a toolbar so that you don't have to dig through the Selections menu each time. And even more time saving is a short bound script for Load Selection that does the Load Selection from Alpha, does the delete, and opens the Save As papimage dialogue. Just a thought.

For those who aren't aware, AKVIS Frames is a free program and you can also download a free frame pack with some 40 or more frames.
Regards,

JoeB
Using PSP 2019 64bit
leahcimi
Posts: 106
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL
Location: SE Cornwall

Re: Resizing script

Post by leahcimi »

Thanks for that useful information.
The only thing I have found 'though is that if I use the script method so that Akvis Frames does the framing, it does appear to use semi-transparent parts of some frames as well as fully transparent.
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: Resizing script

Post by JoeB »

leahcimi wrote:Thanks for that useful information.
The only thing I have found 'though is that if I use the script method so that Akvis Frames does the framing, it does appear to use semi-transparent parts of some frames as well as fully transparent.
Yes, if you look at some of the masks you'll see that some parts are semi-transparent but usually not the main part. The couple I looked at, however, had those semi-transparent parts kind of sprinkled throughout the frame, near where irregular parts of the frame overlap the image, and in at least some cases it shouldn't really detract from the look of the frame on the image. I'm thinking that with frames where it might matter more it might be possible that making them fully transparent might still look good enough on the image. I'll likely experiment with some of the frames in any event simply because I like keeping the aspect ratio of the framed image closer to that of the original image being framed, which isn't happening with the AKVIS program. And I like how using Outside frame in PSP reveals more of the image than AKVIS does, at least with the couple of frames I tried.

EDIT: However, on checking out a few more of the oval ones, you can get some unexpected looking results of the look of the frame when used in PSP as it squeezes the frame to the proportion of the image. Frame 15 is a good example, used by me on a landscape image. The framed image was OK but the almost round medallions to the left are squished top to bottom so not quite the look you might want. Also, some frames won't properly frame the part of the image you want framed, whereas in AKVIS you can at least drag the image around. BUT on the other hand, in PSP with the image being one layer and the frame another you can also move the image layer around under the frame once the frame is applied.

So which frames will work best or at all is going to be a matter of experimenting I'm afraid.
Last edited by JoeB on Mon Mar 05, 2018 1:38 am, edited 3 times in total.
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: Resizing script

Post by LeviFiction »

So I wasn't at all familiar with Akvis. But I just downloaded it and I've just got to say, it is very easy to steal these frames. It's literally a zip folder, with all of the images you need. They aren't even custom formats.

What you want for each frame are the files FrameName.png.Mask an FrameName.png.Data.

FrameName.png.Data is a JFIF file. And FrameName.png.Mask is a greyscale representation of a mask in PNG format. So just open both files in PSP, create a mask "From Image" and choose the mask image set to "Source Luminance" Merge the group and export as Picture Frame.

Video: https://drive.google.com/file/d/1M1OZys ... XHqq7/view
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: Resizing script

Post by JoeB »

LeviFiction wrote:So I wasn't at all familiar with Akvis. But I just downloaded it and I've just got to say, it is very easy to steal these frames. It's literally a zip folder, with all of the images you need. They aren't even custom formats.

What you want for each frame are the files FrameName.png.Mask an FrameName.png.Data.

FrameName.png.Data is a JFIF file. And FrameName.png.Mask is a greyscale representation of a mask in PNG format. So just open both files in PSP, create a mask "From Image" and choose the mask image set to "Source Luminance" Merge the group and export as Picture Frame.

Video: https://drive.google.com/file/d/1M1OZys ... XHqq7/view
Very useful information! More than excellent, and appreciate your taking the time. But not "stealing", eh? They're free, and just being "repurposed". :-)
Regards,

JoeB
Using PSP 2019 64bit
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: Resizing script

Post by JoeB »

Given the number of AKVIS frames there are that can be converted for use as PSP frames with LeviFiction's method, and with the number of steps (i.e., menu accessing, layer merging, etc) I thought I'd just record a simple script. It's obviously very limited in use but may be useful to @leahcimi, who came up with the idea of using AKVIS frames in PSP, and will speed up the process of converting the Akvis frames to .png files that can be used as frames in PSP.

It is VITAL that anyone interested first have followed the link to LeviFiction's video (above) because the script requires that the AKVIS .data and .mask files you are going to use be available (therefore unzipped into some folder first) and open in PSP before running the script. All the script does is automate the process.

Once you have put the .data image in focus then running the script will open the dialogue to allow you to select the accompanying .mask file. Then click OK, which will create the mask layer group and the script will automatically merge the group and open the Export Picture Frame dialogue with the name of the file (i.e., free17.png or whatever number that free frame is). You can just click OK if you are satisfied with that name or rename it before clicking OK, which will save the file in the Picture Frames folder. That's all, but should speed up the processing of more than 40 frames - or many more if anyone has also purchased any of the paid frame packs. :-)

The script goes in your Scripts Trusted folder.
Attachments
AKVIS Frame for PSP.zip
Convert AKVIS frames for use with PSP
(617 Bytes) Downloaded 147 times
Regards,

JoeB
Using PSP 2019 64bit
leahcimi
Posts: 106
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL
Location: SE Cornwall

Re: Resizing script

Post by leahcimi »

Thanks LeviFiction & JoeB for looking into this; there is one problem though.
Your method works fine on the Free Pack but the ZIP file for the one I purchased (SteamPunk Pack) is password protected and the password is not the supplied installation key. :(

I realize that the programme is free but there are some hidden facilities (or at least they are not obvious) like being able to resize & rotate the image in the frame as well as move it.
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: Resizing script

Post by LeviFiction »

EDIT: Well that's that then, if they are encrypting it they don't want it to be used outside the program and I don't actually advise trying to steal their property.

As for rotating, it is more of a process in PSP as you first have to accept the frame, then manually rotate an move the image with the pick tool underneath the frame layer.
https://levifiction.wordpress.com/
leahcimi
Posts: 106
Joined: Fri May 25, 2012 5:29 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Gigabyte Technology Co. Ltd. H61M-D2H-USB3
processor: 3.40 gigahertz Intel Core i7-2600K
ram: 16GB
Video Card: Intel HD Graphics 3000
sound_card: High Definition Audio Device
Hard_Drive_Capacity: 250GB 500G
Monitor/Display Make & Model: Acer S240HL
Location: SE Cornwall

Re: Resizing script

Post by leahcimi »

I guess so but you can resize & rotate images within a frame in Akvis Frames itself.
Post Reply