Created
May 9, 2023 03:06
-
-
Save themactep/10d739271d4aebc9fe44b6ad16958e77 to your computer and use it in GitHub Desktop.
thumbnailer for .scad files
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/bash | |
# .SCAD files thumbnailer | |
# 2022, Paul Philippov, paul@themactep.com | |
OS=$(command -v openscad || command -v openscad-nightly) | |
$OS -o "$2.png" -D "\$fn=128" --autocenter --viewall \ | |
--colorscheme="Tomorrow Night" -q "$1" | |
[ ! -f "$2.png" ] && echo "Cannot find image!" && exit 1 | |
mogrify -fuzz "1%" -transparent "#1d1f21" -trim +repage -resize "$3x$3>" \ | |
-gravity center -background transparent -extent "$3x$3" "$2.png" | |
mv "$2.png" "$2" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment