plottertools / hatched Goto Github PK
View Code? Open in Web Editor NEWConvert images to plotter-friendly hatched patterns
License: MIT License
Convert images to plotter-friendly hatched patterns
License: MIT License
Hi,
I'm unable to get the install to work. I get the following message:
`Collecting Shapely[vectorized]==1.8.0
Using cached Shapely-1.8.0.tar.gz (278 kB)
Preparing metadata (setup.py) ... error
error: subprocess-exited-with-error
ร python setup.py egg_info did not run successfully.`
Any thoughts? I'm setting up a venv in conda and using the pip command provided. I successfully installed Shapely independently afterwards thinking that might solve the issue but the general install still stalls. Thanks!
I'm running into this error:
ERROR:shapely.geos:TopologyException: Input geom 0 is invalid: Ring Self-intersection at or near point 96 320 at 96 320 Error: The operation 'GEOSDifference_r' could not be performed. Likely cause is invalidity of the geometry <shapely.geometry.polygon.Polygon object at 0x00000268A8F91DF0>
Hey there, I have been running the code with bigger and denser images (around A4, hatch pitch = 4), which takes me 30min+.
Are there already any initiatives to implement multiprocessing or something to speed it up? Or can I pick this up?
Thanks!
It would be useful to be able to set the angle for the hatched lines
And cool to be able to vary / modulate the angle too but let's not get ahead of ourselves ๐
I had to fix Shapely version on 1.7.1 since I was getting an exception/error.
My OS is Windows 10, Python 3.9.10 and Shapely 1.8.0.
The code ran but didn't write any output. Here is the error trace:
C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\hatched\hatched.py:246: ShapelyDeprecationWarning: The proxy geometries (through the 'asShape()', 'asMultiLineString()' or 'MultiLineStringAdapter()' constructors) are deprecated and will be removed in Shapely 2.0. Use the 'shape()' function or the standard 'MultiLineString()' constructor instead.
mls, black_cnt, dark_cnt, light_cnt = _build_hatch(
Exception ignored in: <function BaseGeometry.__del__ at 0x000002596302D3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x000002596302D3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x000002596302D3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x000002596302D3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x000002596302D3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x000002596302D3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\hatched\hatched.py:197: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
[ls for ls in light_mls] + [ls for ls in dark_mls] + [ls for ls in black_mls]
(art) C:\Users\maria\Desktop\Plotter\Cutes>vpype hatched --levels 20 100 180 -p 5 -b 1 skull.png show
C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\hatched\hatched.py:246: ShapelyDeprecationWarning: The proxy geometries (through the 'asShape()', 'asMultiLineString()' or 'MultiLineStringAdapter()' constructors) are deprecated and will be removed in Shapely 2.0. Use the 'shape()' function or the standard 'MultiLineString()' constructor instead.
mls, black_cnt, dark_cnt, light_cnt = _build_hatch(
Exception ignored in: <function BaseGeometry.__del__ at 0x0000025A3837E3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x0000025A3837E3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x0000025A3837E3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x0000025A3837E3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x0000025A3837E3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
Exception ignored in: <function BaseGeometry.__del__ at 0x0000025A3837E3A0>
Traceback (most recent call last):
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 209, in __del__
self._empty(val=None)
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\base.py", line 199, in _empty
self._is_empty = True
File "C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\shapely\geometry\proxy.py", line 44, in __setattr__
object.__setattr__(self, name, value)
AttributeError: can't set attribute
C:\Users\maria\Documents\genart\vsketch\art\lib\site-packages\hatched\hatched.py:197: ShapelyDeprecationWarning: Iteration over multi-part geometries is deprecated and will be removed in Shapely 2.0. Use the `geoms` property to access the constituent parts of a multi-part geometry.
[ls for ls in light_mls] + [ls for ls in dark_mls] + [ls for ls in black_mls] ```
Using the skull.png
file, I run vpype hatched --levels 20 100 180 -p 5 -b 1 skull.png write hatched.svg
and get
Error: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()
WARNING:root:no geometry to save, no file created
I'm on an M1 mac and my install is a bit messed up ('vpype show' doesn't work), but I wouldn't have thought it affected anything other than the fancy show
.
I wonder if you can make x,y for circular, not always the middle of the art work.
Also CMYK layer?
Thanks :)
After installing with pipx inject I get qt error when I try to use vpype show e.g. "vpype random show" works fine, but after injecting hatched I get the error below. Thoughts?
$ vpype --version
vpype 1.11.0a0
$ pipx inject vpype hatched
injected package hatched into venv vpype
done!
$ vpype random show
QObject::moveToThread: Current thread (0x564880d67810) is not the object's thread (0x564880d74d20).
Cannot move to target thread (0x564880d67810)
qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "/home/art/.local/pipx/venvs/vpype/lib/python3.9/site-packages/cv2/qt/plugins" even though it was found.
This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: xcb, eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl.
Aborted
Currently, the physical span of hatched
's output is determined by the combination of the image resolution and the scaling factor (-s
). This is unfortunate because the output's physical dimension is often something the user might want to control.
Specifically, in order to adjust the image scaling factor while keeping the same line density and physical size requires quite the contortion:
# same dimension and density:
vpype hatched -p 1mm input.png
vpype hatched -p 0.5mm -s 0.5 input.png scale 2 2
This would be solved by adding a -a/--area X Y
parameter to control the physical output size. In particular, it would allow to freely adjust the scale without impacting the output dimension nor the line density:
# same dimension and density:
vpype hatched -p 1mm -a 10cm 10cm input.png
vpype hatched -s 0.5 -p 1mm -a 10cm 10cm input.png
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.