Skip to content

Instantly share code, notes, and snippets.

@themactep
Created May 9, 2023 03:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save themactep/10d739271d4aebc9fe44b6ad16958e77 to your computer and use it in GitHub Desktop.
Save themactep/10d739271d4aebc9fe44b6ad16958e77 to your computer and use it in GitHub Desktop.
thumbnailer for .scad files
#!/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