Scripts - Vectorize Raster

Moderator: Kathy_9

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

Scripts - Vectorize Raster

Post by LeviFiction »

Script Name: VectorizeImage & VectorizeLayer
Download: ... sp=sharing
Just Script the - ... sp=sharing
Compatibility: PSP 9-2023
Requirements: Place in Scripts-Trusted Folder
Extra requirements - If you already have the selection To Path script you don't need to re-download Potrace. The Script-Only version will be just fine.

If you don't have Potrace and you downloaded Script Only version you need the Potrace program found here -

Description: This script attempts to use my selectionToPath script to vectorize a raster image. It does this by first decreasing the number of colors in the image. You can choose between 2 - 256 colors (smaller numbers are faster). Then creating a vector shape for each color in the palette. The end result should be a noisy approximation of your raster layer.

Simple shapes and colors are best, so flat graphics, not photos. And the fewer colors the better.

The two scripts are "Vectorize Image" and "Vectorize Layer". This process is destructive, so both scripts create a copy of your image to work non-destructively. The first one will merge all of the layers into one image and vectorize the whole image. While the second will create a flat version of your layer, vectorize that. Placing the final vectorized image onto a vector layer in your current image.

It's not perfect, and there are definite ways to improve the speed with additional command-line programs. But for now this is a good basic starting point.

I'm not kidding when I say keep the number of colors low. These scripts can take anywhere from 5-30 seconds per color. If PSP is acting particularly slow or the image is very large and you go for the full 256 colors you could be waiting a minimum of 21 minutes. That's not great. I recommend sticking to 10-15 colors max. I will work on making the scripts faster.