batch Adding border to only 1 side of image

Moderator: Kathy_9

Post Reply
jclement
Posts: 3
Joined: Thu Oct 25, 2018 4:12 pm
operating_system: Windows 10
System_Drive: C

batch Adding border to only 1 side of image

Post by jclement »

I have a set of images which were obtained from scans. They are all in portrait mode, but have slightly different sizes and aspect ratios. I want to add a border on just one side using batch. So I created a script:
1. Resize for a fixed pixel height.
2. Resize canvass image right justified to a fixed width, same height as 1.

It almost worked correctly, but not quite. The aspect ratio of the images was changed, so some of the images had narrow people.

I have not found any documentation about how to manually write a script. If the scripting language has variables that I can manipulate, I might be able to create the script I want. I just now found the option to set just one side in the resize function. That might have worked OK. But then I have to do the subsequent Resize Canvass. If it gives funny results in batch, then there should be a warning while storing the script. It would seem that only the one side option or percentage selections will give consistent results in a script. Apparently the fixed X, Y pixel selections override the Lock aspect ratio check box. The fact that I selected the height while creating the script then apparently selected a fixed width for all subsequent images in the batch run. Yeuch!

The Resize Canvass is also a broblem My requirements would be met if Resize Canvass had a percentage option for width and height. Better yet have a method of selecting one of them with an aspect ratio selection that would determine the other, as in the Resize function. So I could select 1.0 for height, with an aspect ratio of 16:9 or 1.333 aka 4:3 or whatever. Either check boxes for activation, or zero entries for deactivation could be used. Here there is also a problem with batch. Does the selection Placement override the top, bottom, left, right selections? The logic here is very ambiguous.


Actually I am editing 3D side by side pictures and I wanted to have a black border only on the L to accomodated text info for a 3D slide show. So I had to batch turn the 3D shots into sepearate L/R images; use PSP to setup the border (which I later found didn't work properly); and then use the Stereo Photo Editor batch to recombine the separate L/R images. After manually putting in many text labels using Stereo Photo Editor, I am very annoyed to find the aspect ratios were changed. So I will have to go back and redo the days of work. A little documentation about how a given option might not work correctly in batch might have been helpful, or a warning when saving the script.
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: batch Adding border to only 1 side of image

Post by LeviFiction »

Well, first off, in this board the top pinned topic has resources for learning scripting in PSP. You can see it here: viewtopic.php?f=104&t=56846

It includes links to the most recent APIs, a scripting for script author's guide that introduces the basics of scripting in PSP, and various script examples you can download and look at. PSP uses the Python programming language so you can do a lot with scripting. Though, in your case, you may not need to go that far. Hard to say.

Kind of a fun note. A lot of what happens in the command dialog boxes is specific to that dialog box and not to the command in a script. For example, maintaining the aspect ratio is done in the resize dialog box not by the resize command at all. If you do resize by side then the resize command does maintain the aspect ratio. But setting specific widths and heights doesn't tell PSP which one should take priority when resizing an image of a different size. Hence the "by side" option.

As for the resize canvas dialog, where scripts are concerned if you use the buttons then the buttons take precedence. If you manually set the text boxes then they take precedence.

Actually let me be a bit more specific.

The command ResizeCanvas has two auto-settings: vertplace an horizplace. If these are set to the top, center, bottom, or left, center, right, settings then they will auto place the the image according to the new size of the canvas. However, if you manually edit one of the text boxes then they will change to a custom value and the settings for Top, Bottom, Left, and Right will take over. So if you edit either Top or Bottom then vertplace will change to "App.Constants.VerticalType.Custom" and and if you change left or right then horizplace will change to"App.Constants.HorizontalType.Custom." In this way you can auto-place an image vertically in the center by hitting the vertical center point and then manually enter a left or right position in the text boxes. Then only left and right will be manually set and the top and bottom will be done automatically. Also it gives priority to the Top side over the bottom side when setting them manually, and the left side over the right side.
https://levifiction.wordpress.com/
Post Reply