diff options
Diffstat (limited to 'Envelope (mathematics) generator/index.md')
| -rw-r--r-- | Envelope (mathematics) generator/index.md | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/Envelope (mathematics) generator/index.md b/Envelope (mathematics) generator/index.md new file mode 100644 index 0000000..423d750 --- /dev/null +++ b/Envelope (mathematics) generator/index.md @@ -0,0 +1,35 @@ +--- +description: Generating geometric line art +created: 2024-05-12 +--- + + + +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/) +```sh +pip install pillow~=10.3 +``` + +```python +from PIL import Image, ImageDraw + +# https://en.wikipedia.org/wiki/Envelope_%28mathematics%29 + +dim = 200 # Image dimensions (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: # mode="RGBA" for transparent background + 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") +``` |
