Script - Selection To Path

Moderator: Kathy_9

LeviFiction
Advisor
Posts: 6472
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

Script - Selection To Path

Post by LeviFiction »

Script Name: Selection to Path
Download: https://drive.google.com/file/d/1mnZ-mo ... sp=sharing
Just Script the - https://drive.google.com/file/d/1ZZKHpT ... sp=sharing
Compatibility: PSP 9-2023
Requirements: Place in Scripts-Trusted Folder
Extra requirements - If you download Script Only version you need the potrace program found here - http://potrace.sourceforge.net/#downloading

Description: I've had this script since 2018, Cassel asked me what I would do if PSP could vectorize a raster image. I had no idea, so I spent the night making this as a test. (the hardest part was the SVG import code) I never did manage to come up with a satisfactory answer to her question. The code is still amateurish but it gets the basic job done.

This script will take any raster selection outline and convert it to a vector path. I want to be clear, this converts the selection outline only not the contents in the selection. It uses a program called Potrace by Peter Selinger. This program uses B&W images to create vector paths. Hence the use of selections. A selection is either true or false, on or off, black or white. I've successfully used this to create complex vector shapes in just a few clicks by using a selection around an object in a photo and then converting that selection to a path.

Installation is easy, just unzip everything in the zip folder into your Scripts-Trusted folder. Then make a selection and run the script.

If you don't like the idea of downloading an exe provided by me there is also the "just script' version. Unzip the script into your scripts trusted folder, then follow the link above to download the latest version of Potrace. Unzip the potrace.exe into your scripts-trusted folder and run the script.
Kathy_9
Site Admin
Posts: 2699
Joined: Tue Nov 30, 2010 12:44 am
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
processor: 8th Generation Intel Core i7 8700 3 20 GHz
ram: 16GB
Video Card: NVIDIA GeForce RTX 2060 [6 GB GDDR6 dedicated]
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2TB
Monitor/Display Make & Model: HP EliteDisplay E243m 23.8-inch
Corel programs: PSPX2 ~2023; Painter 2018~22
Location: USA

Re: Script - Selection To Path

Post by Kathy_9 »

Very cool and as you said, easy to use. Thanks!
PSPX9 | PSP2019 | PSP2020 | PSP2021| PSP2022 | PSP2023 & PhotoMirage installed; PSPX | PSPX2 thru PSP2018 owned but not installed
http://www.flickr.com/photos/37153430@N03/
User avatar
sheng-si
Posts: 52
Joined: Fri Dec 28, 2012 12:14 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: Hp motherb
processor: amd
ram: 64 GB
Hard_Drive_Capacity: 1 tb
Monitor/Display Make & Model: acer
Corel programs: paintshop pro 2022
Location: Netherlands

Re: Script - Selection To Path

Post by sheng-si »

I was looking on a harddisk and found this info from 2005 in a PDF file
Delineate raster to svg converter
using potrace or autotrace Potrace gave better results.

it was here http://delineate.sourceforge.net/
and downloads for Mac, Linux and Windows still available.
Not tested by myself (yet)
Admin FB Paintshop Pro NLD for dutch users.
LeviFiction
Advisor
Posts: 6472
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: Script - Selection To Path

Post by LeviFiction »

Okay, have fun. If you want a good raster to vector program I recommend using Inkscape. Along with being a full vector editor it also uses Potrace under the hood to do raster to vector tracing, and can support color images. This is what my next script will also attempt to do as well. Using a very simple, but slow, method.