summary refs log tree commit diff
diff options
context:
space:
mode:
authoruser <user@node5.net>2024-05-12 18:46:14 +0200
committeruser <user@node5.net>2024-05-12 18:46:14 +0200
commitc3f8453bd51e3176233dcda51ae227b56f41e9c5 (patch)
tree19a7b9da3b9f056efe3d7b6cd26b85330901d290
parentafd488a202d7b853c4eaef5545b8793280f6d9bd (diff)
Envelope (mathematics) geometrical line art generator script
-rw-r--r--How-to/Python/Envelope (mathematics) generator/Envelope.pngbin0 -> 80865 bytes
-rw-r--r--How-to/Python/Envelope (mathematics) generator/Thumbnail.pngbin0 -> 2297 bytes
-rw-r--r--How-to/Python/Envelope (mathematics) generator/index.md35
3 files changed, 35 insertions, 0 deletions
diff --git a/How-to/Python/Envelope (mathematics) generator/Envelope.png b/How-to/Python/Envelope (mathematics) generator/Envelope.png
new file mode 100644
index 0000000..f7cf72c
--- /dev/null
+++ b/How-to/Python/Envelope (mathematics) generator/Envelope.png
Binary files differdiff --git a/How-to/Python/Envelope (mathematics) generator/Thumbnail.png b/How-to/Python/Envelope (mathematics) generator/Thumbnail.png
new file mode 100644
index 0000000..01eb49e
--- /dev/null
+++ b/How-to/Python/Envelope (mathematics) generator/Thumbnail.png
Binary files differdiff --git a/How-to/Python/Envelope (mathematics) generator/index.md b/How-to/Python/Envelope (mathematics) generator/index.md
new file mode 100644
index 0000000..3b29dcf
--- /dev/null
+++ b/How-to/Python/Envelope (mathematics) generator/index.md
@@ -0,0 +1,35 @@
+---
+description: Generating geometric line art
+created: 2024-05-12
+---
+
+![Envelope](Envelope.png)
+
+Needed a clean picture of [Envelope (mathematics)](https://en.wikipedia.org/wiki/Envelope_%28mathematics%29), 
+for PCB silk screen art.
+I used [Python Pillow](https://python-pillow.org/)
+```
+pip install pillow~=10.3
+```
+
+```python
+from PIL import Image, ImageDraw
+
+# https://en.wikipedia.org/wiki/Envelope_%28mathematics%29
+
+dim = 200  # Image dimmensions (pixels)
+skip = 10   # Only draw a line every X pixels
+width = 1   # Line width
+color = "white"
+
+with Image.new(mode = "RGB", size = (dim, dim)) as im:
+    draw = ImageDraw.Draw(im)
+
+    for i in range(dim):
+        if i % skip:
+            continue
+        rev = dim - i
+        draw.line([(0, i), (i, dim)], fill=color, width=width) 
+    
+    im.show()  # im.save("/tmp/Envelope.png")
+```
\ No newline at end of file