Last active
April 28, 2024 23:16
-
-
Save MiniCodeMonkey/a1306e54898ba0260a81 to your computer and use it in GitHub Desktop.
PNG to 3d object for 3d printing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
for f in *.png | |
do | |
filename=${f%.*} | |
echo "Processing $filename" | |
# png -> bmp | |
convert $filename.png -normalize -fx 'a==0 ? white : u' $filename.bmp | |
# trace bitmap to eps | |
potrace $filename.bmp -o $filename.eps | |
# eps -> dxf | |
pstoedit -dt -f "dxf: -polyaslines -mm" $filename.eps $filename.dxf | |
# extrude vector image to 3d model with openscad | |
openscad -o $filename.stl -D "image=\"$filename.dxf\"" generate.scad | |
done |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
linear_extrude(height = 2, center = true, convexity = 10) | |
import(file = image); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment