Sunday, February 25, 2024

Potrace with LIVE PREVIEW

 (MrQ_Potrace_Live_Preview.py)

Authors: MareroQ
Source code Potrace: Peter Selinger
Source code Live Preview: Tin Tran
 
Potrace website :https://potrace.sourceforge.net/#technical
Live Preview (gtk2) according to the idea of Tin Tran http://gimpchat.com/viewtopic.php?f=9&t=9586#p284974
Older version (updated to Ver. 0.7): Plugin-potrace.py https://www.gimpscripts.net/2020/09/plugin-potracepy-ver-05.html
 
Ver. 0.7.- creates a new image (so it has more possibilities than Live Preview).


Creates a scalable SVG image from the active layer with Live Preview. Requires a separate potrace program that must be installed in the Gimp bin directory (for Windows 64bit it is included in the ZIP - for Linux and Mac OS X in Potrace website). The SVG file is saved in your home directory in the "tmp" folder.

Potrace(TM) as a bitmap tracing tool, which means transforming a bitmap into a smooth, scalable image. The input is a bitmap (BMP format) and the output is an SVG file.
The resulting image is not "jagged" like a bitmap, but smooth. It can then be rendered at any resolution.

Mkbitmap is a program distributed with Potrace that can be used to preprocess input data for better tracking of grayscale and color images.

Parameters

Name SVG file:
If you do not change the name, the file will be overwritten.
For name do not use spaces & special characters.

Turdsize:
Suppress speckles of up to this many pixels.
    
Alphamax:
Set the corner threshold parameter. The default value is 1. The smaller this value, the more sharp corners will be produced.
If this parameter is 0, then no smoothing will be performed and the output is a polygon.
If this parameter is greater than 4/3, then all corners are suppressed and the output is completely smooth.

Opttolerance:
Set the curve optimization tolerance. The default value is 0.2. Larger values allow more consecutive Bezier curve segments to be joined together in a single segment, at the expense of accuracy.

Stroke Path Width:
- when width = 0 then the paths is visible
- when width > 0 the paths are invisible and the path is stroke on a new transparent layer.

In menu: Filters ➤ Edge-Detect ➤ Potrace with Live Preview...
 


SVG opened in Gimp:
 
SVG opened in Inkscape:


Ver.1.1.
(27-02-2024)

Changes:
added select color FG svg visible only when you open a newly created svg file (previously only default = black). The fill color remained transparent by default.


 
Ver.1.2.
(28-02-2024) 
 
Changes:
added option - Open SVG file as new image:"None","Many, Individual","One, Merged","Interactive".
 
 
Ver.1.3.
(29-02-2024) 

Changes:
- replace transparency (if alpha channel exists) to BG color (on added copy).



No comments:

Post a Comment

Keep the tone of your comments civil and courteous. Keep in mind that there are no authors of plugins and scripts manning this site. Any comments posted for help or requests may go unanswered. Go to GimpChat.com and do a search instead.