Commit 5316a4e2 authored by Juergen Weigert's avatar Juergen Weigert

0.4 replace option added to make the bitmap automatically disappear.

parent 5750e82a
......@@ -6,7 +6,8 @@
<dependency type="executable" location="extensions">inkex.py</dependency>
<dependency type="executable" location="extensions">centerline-trace.py</dependency>
<param name="invert" type="boolean" _gui-text="Trace bright lines. Default: dark lines.">false</param>
<param name="remove" type="boolean" _gui-text="Replace image with vector graphics. (Default: Place on top)">false</param>
<param name="invert" type="boolean" _gui-text="Trace bright lines. (Default: dark lines)">false</param>
<param name="megapixels" type="float" min="0.1" max="99.9" precision="1" _gui-text="Limit image size in megapixels (Default: 2.0; lower is faster).">2.0</param>
<param name="candidates" type="int" min="1" max="255" _gui-text="[1..255] Autotrace candidate runs. Use 1 with noisy photos. (Default: 1; lower is much faster)">1</param>
<param name="filters" type="description">
......@@ -18,9 +19,9 @@
<!-- Keep in sync with chain_paths.py line 16 __version__ = ... -->
<param name="about_version" type="description">
Please report praise or strange results with the issue tracker at
https://github.com/fablabnbg/inkscape-centerline-trace
Version 0.3</param>
Version 0.4</param>
<effect needs-live-preview="false" >
<object-type>path</object-type>
......
......@@ -43,9 +43,10 @@
# 2016-05-10 jw, V0.1 -- initial draught
# 2016-05-11 jw, V0.2 -- first usable inkscape-extension
# 2016-05-15 jw, V0.3 -- equal spatial illumination applied. autocontrast instead of equalize. denoise.
# 2016-05-16 jw, V0.4 -- added replace option. Made filters optional.
#
__version__ = '0.3' # Keep in sync with chain_paths.inx ca line 22
__version__ = '0.4' # Keep in sync with chain_paths.inx ca line 22
__author__ = 'Juergen Weigert <juewei@fabmail.org>'
import sys, os, re, math, tempfile, subprocess, base64
......@@ -99,6 +100,7 @@ class TraceCenterline(inkex.Effect):
self.autotrace_opts=[] # extra options for autotrace tuning.
self.megapixel_limit = 2.0 # max image size (limit needed, as we have no progress indicator)
self.invert_image = False # True: trace bright lines.
self.replace_image = False # True: remove image object when adding path object.
self.candidates = 15 # [1..255] Number of autotrace candidate runs.
self.filter_median = 0 # 0 to disable median filter.
self.filter_equal_light = 0.0 # [0.0 .. 1.9] Use 1.0 with photos. Use 0.0 with perfect scans.
......@@ -116,6 +118,7 @@ class TraceCenterline(inkex.Effect):
action = 'store_const', const=True, dest='version', default=False,
help='Just print version number ("'+__version__+'") and exit.')
self.OptionParser.add_option('-i', '--invert', action='store', type='inkbool', default=False, help='Trace bright lines. (Default: dark lines)')
self.OptionParser.add_option('-r', '--remove', action='store', type='inkbool', default=False, help='Replace image with vector graphics. (Default: Place on top)')
self.OptionParser.add_option('-m', '--megapixels', action='store',
type='float', default=2.0, help="Limit image size in megapixels. (Lower is faster)")
self.OptionParser.add_option('-e', '--equal-light', action='store',
......@@ -301,9 +304,10 @@ class TraceCenterline(inkex.Effect):
if self.options.version:
print __version__
sys.exit(0)
if self.options.invert is not None: self.invert_image = self.options.invert
if self.options.remove is not None: self.replace_image = self.options.remove
if self.options.megapixels is not None: self.megapixel_limit = self.options.megapixels
if self.options.candidates is not None: self.candidates = self.options.candidates
if self.options.invert is not None: self.invert_image = self.options.invert
if self.options.despecle is not None: self.filter_median = self.options.despecle
if self.options.equal_light is not None: self.filter_equal_light = self.options.equal_light
......@@ -377,6 +381,8 @@ class TraceCenterline(inkex.Effect):
path_attr = { 'style': simplestyle.formatStyle(style), 'd': path_d, 'transform': matrix }
## insert the new path object
inkex.etree.SubElement(self.current_layer, inkex.addNS('path', 'svg'), path_attr)
## delete the old image object
if self.replace_image: node.getparent().remove(node)
......
......@@ -4,12 +4,13 @@
name=$1
vers=$2
url=http://github.com/fablabnbg/inkscape-centerline-trace
requires="autotrace, python3-PIL | bash, python-PIL"
requires="autotrace, python3-pil | bash, python-pil"
tmp=../out
[ -d $tmp ] && rm -rf $tmp/*.deb
mkdir $tmp
cp description-pak files
cd files
fakeroot checkinstall --fstrans --reset-uid --type debian \
--install=no -y --pkgname $name --pkgversion $vers --arch all \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment