From f71ca7f91cec8c4272c4f2b6025931db6d505a1c Mon Sep 17 00:00:00 2001 From: Wouter Verweirder Date: Fri, 16 Oct 2026 21:32:01 +0200 Subject: [PATCH] fix python warnings - v0.0.3 --- __init__.py | 2 +- pyproject.toml | 2 +- src/penplotter/trace_skeleton.py | 24 ++++++++++++++++-------- 3 files changed, 18 insertions(+), 10 deletions(-) diff --git a/__init__.py b/__init__.py index 58d32cb..fd01cd9 100644 --- a/__init__.py +++ b/__init__.py @@ -8,7 +8,7 @@ __all__ = [ __author__ = """Wouter Verweirder""" __email__ = "wouter.verweirder@gmail.com" -__version__ = "0.0.2" +__version__ = "0.0.3" from .src.penplotter.nodes import NODE_CLASS_MAPPINGS from .src.penplotter.nodes import NODE_DISPLAY_NAME_MAPPINGS diff --git a/pyproject.toml b/pyproject.toml index a72fb68..0bc0a18 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "comfyui-penplotter" -version = "0.0.2" +version = "0.0.3" description = "Custom nodes to convert images to pen plotter files" authors = [ {name = "Wouter Verweirder", email = "wouter.verweirder@gmail.com"} diff --git a/src/penplotter/trace_skeleton.py b/src/penplotter/trace_skeleton.py index 8bdd90c..4da9f2e 100644 --- a/src/penplotter/trace_skeleton.py +++ b/src/penplotter/trace_skeleton.py @@ -177,19 +177,25 @@ def mergeFrags(c0, c1, sx, dr): def chunkToFrags(im, x, y, w, h): frags = [] on = False; # to deal with strokes thicker than 1px - li=-1; lj=-1; + li=-1; + lj=-1; # walk around the edge clockwise for k in range(h+h+w+w-4): - i=0; j=0; + i=0; + j=0; if (k < w): - i = y+0; j = x+k; + i = y+0; + j = x+k; elif (k < w+h-1): - i = y+k-w+1; j = x+w-1; + i = y+k-w+1; + j = x+w-1; elif (k < w+h+w-2): - i = y+h-1; j = x+w-(k-w-h+3); + i = y+h-1; + j = x+w-(k-w-h+3); else: - i = y+h-(k-w-h-w+4); j = x+0; + i = y+h-(k-w-h-w+4); + j = x+0; if (im[i,j]): # found an outgoing pixel if (not on): # left side of stroke @@ -275,11 +281,13 @@ def traceSkeleton(im, x, y, w, h, csize, maxIter, rects): s = np.sum(im[i-1:i+1, x:x+w]) if (s < ms): - ms = s; mi = i; + ms = s; + mi = i; elif (s == ms and abs(i-(y+h//2)) csize): # same as above, try splitting left and right for j in range(x+3,x+w-2):