How can I create PNG image files from STL files? I need to add some simple image renders of STL files to a document.  I currently open the STL files in Preview or one of the slicers and grab a screen shot.

Is there an easier or automatic way to generate PNG images from STL files on a Mac?
If you have OpenSCAD installed, this shell script will generate 100x100 pixel PNG images for each STL file in your current directory.

for i in *.stl; do
  T=__tmp__$i
  b=`basename $i`
  echo import\(\"$i\"\)\; &gt;$T
  /Applications/OpenSCAD.app/Contents/MacOS/OpenSCAD -o $b.png --imgsize=100,100 $T
  rm $T
done


Credit to 0scar for pointing out STL files can be imported into OpenSCAD.

Update: This code does the same, and generates an html file with annotated images of the files rendered.  When I printed a batch of spare parts for my 3D printer I made a hardcopy and stuck it in the box so I could identify the parts later.

n=-1
H=00-catalog.html
echo &gt;$H '&lt;table&gt;'
echo &gt;&gt;$H '  &lt;tr&gt;'
for i in $*; do
  n=`expr $n + 1`
  if test $n = 4; then
      n=0
      echo &gt;&gt;$H '  &lt;/tr&gt;'
      echo &gt;&gt;$H '  &lt;tr&gt;'
  fi
  echo $i
  T=__tmp__$i
  B=`basename $i .stl`
  echo import\(\"$i\"\)\; &gt;$T
  /Applications/OpenSCAD.app//Contents/MacOS/OpenSCAD -o $B.png --imgsize=200,200 $T
  echo &gt;&gt;$H
  echo &gt;&gt;$H '    &lt;td&gt;'$i'&lt;br&gt;&lt;img src="'$B'.png"&gt;&lt;/td&gt;'

  rm $T
done
echo &gt;&gt;$H '  &lt;/tr&gt;'
echo &gt;&gt;$H '&lt;/table&gt;'