I came across this old, 2009 script that creates borders on smaller layer images. (Despite the Author info I did NOT create this - at least not without the help of a bunch of people in the Jasc groups - can't remember who from that far back!). The attachment has the original script plus a copy with TEST in the name. That copy is one where I made all steps interactive to see what was happening and the one you might want to examine.
Anyway, it creates an Outside border on the smaller layer image (but only a rectangle so no good for rotated images for example). BUT the important thing is that the border has square corners, not rounded. And in doing so it first selects the small image on the layer and then expands the selection. At that stage the expanded selection DOES have rounded corners. But after the next step where it uses Select Selection Borders>Inside, the border now has square corners both on the outside and inside selection marquee. I cannot see any step that would have converted the rounded selection it started with to a square cornered selection. I can only suspect that it has something to do with the manner in which the script finds the selection - or the image position information - somewhere along the way but could be out to lunch on that.
So I was hoping that you would be able to figure out how this is happening because I would like to modify my border script to also do outside borders with square corners. Thanks!
LeviFiction - Could you check this Border script?
Moderator: Kathy_9
-
JoeB
- Posts: 2778
- Joined: Fri Mar 28, 2008 10:04 pm
- 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
LeviFiction - Could you check this Border script?
- Attachments
-
- 03.zip
- Outside Border script with square corners.
- (3.82 KiB) Downloaded 250 times
Regards,
JoeB
Using PSP 2019 64bit
JoeB
Using PSP 2019 64bit
-
LeviFiction
- Advisor
- Posts: 6831
- Joined: Thu Oct 02, 2008 1:07 pm
- 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: LeviFiction - Could you check this Border script?
It's using the "Selction from Current Selection" option found next to the "Selection from Opaque" to create a new selection based on the selection rectangle of a current selection.
So the full idea is this.
1) It selects all of the opaque areas of the layer
2) It expands the Selection to the border width you want using ExpandSelection
3) It creates a new rectangular selection based on the selection bounding box. - Uses "Create Selection From: Current Selection" In script this selection modification type is called App.Constants.SelectionModifyType.SurroundCurrent.
4) Use SelectSelectionBorders to select only the expanded selection areas - anti-alias set to false to remove any smooth corners, inside selection to make sure it's selecting into the current seelction, set to the same width as ExpandSelection
And that's how that works.
For the most part, that method works very well. And it's something easily recorded.
A slightly faster way to get the same effect, though far more custom and requiring coding, would be to use ReturnLayerProperties to get the Layer Rectangle. Then making two calls to Selection - 1 to replace the current selection with the selection rect + the border width. Another to remove the original selection rectangle. Which is what my current method is.
So the full idea is this.
1) It selects all of the opaque areas of the layer
2) It expands the Selection to the border width you want using ExpandSelection
3) It creates a new rectangular selection based on the selection bounding box. - Uses "Create Selection From: Current Selection" In script this selection modification type is called App.Constants.SelectionModifyType.SurroundCurrent.
4) Use SelectSelectionBorders to select only the expanded selection areas - anti-alias set to false to remove any smooth corners, inside selection to make sure it's selecting into the current seelction, set to the same width as ExpandSelection
And that's how that works.
For the most part, that method works very well. And it's something easily recorded.
A slightly faster way to get the same effect, though far more custom and requiring coding, would be to use ReturnLayerProperties to get the Layer Rectangle. Then making two calls to Selection - 1 to replace the current selection with the selection rect + the border width. Another to remove the original selection rectangle. Which is what my current method is.
https://levifiction.wordpress.com/
-
JoeB
- Posts: 2778
- Joined: Fri Mar 28, 2008 10:04 pm
- 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: LeviFiction - Could you check this Border script?
Thanks ton for that info! Prior to finding this script I was thinking that I wanted a way to select the rounded selection with a square selection but hadn't realized that there was a tool (Selection from Current Selection) that would actually do that. And when reading the script I didn't know that SurroundCurrent was referencing that tool, which is why I got stuck at that point. Live and learn!
However, now that I've checked it out, it won't work for my script because it only creates rectangular selections, and they are horizontal/vertical so won't work on rotated images or those with irregular shapes.
Still, I learned something useful so thanks again!
However, now that I've checked it out, it won't work for my script because it only creates rectangular selections, and they are horizontal/vertical so won't work on rotated images or those with irregular shapes.
Regards,
JoeB
Using PSP 2019 64bit
JoeB
Using PSP 2019 64bit
