Post by papa on Aug 8, 2021 18:40:15 GMT
Guess I’ll write a little about a new project of mine, stltopng.
It’s a small command-line tool that can be passed a STL file. Then, using my STL Thumbnails, it takes a preview picture of the STL and stores it in PNG format.
Why would you want to do that?
Well, it’s for automation mostly. It can generate a few hundred previews per minute. If you have website where you provide your designs, you’re happy if you can let your server generate previews automatically!
I’ve heard from some companys that they use preview images in their customer management system because these often can’t handle STL natively.
One user wants their printer to display an image of the STL file that’s currently being printed, and stltopng comes in handy there.
Of course it’s also a blessing if you just want to provide a catalog of your STL files for someone else!
How does it work?
First off, it requires my STL Thumbnails being installed.
Then, download stltopng.exe from my website.
If you just want to get an image quickly, drag & drop the STL on stltopng. It should create the image stl.png. Done.
If you want to use it for scripting, call it via
This will create a preview image of approx. 1000×1000 pixels from the given STL at the given path. It returns zero on success. On failure, it writes to stderr and returns a non-zero value.
But the colors! And I’d like to have a rotated view!
You can adjust the colors and the viewing angle via my STL Thumbnail settings in the registry. The background may be black in many images because one of the Windows functions I currently use cannot handle transparency well.
That’s cumbersome to use. And the images aren’t even exactly the size I specified!
I know! An improved version is to come. But here’s the catch: The STL Thumbnails were developed for Windows, and Windows always asks for square images with a centered object from a static angle. In order to specify exact image dimensions, colors, and viewing angle from the command line, my STL Thumbnails must be modified and the updated version must be bundled with stltopng. This requires thorough testing and will take a while. Guess what we have now is better than nothing!
I attached the source code in case someone needs a novel way to call my thumbnails programmatically. (It’s a standard interface that can be used from any C++/.NET/VB program in case you didn’t know.)
stltopng.cpp (7.09 KB)
Maybe it’s useful to someone here. If so, let me know of your problems and suggestions!
It’s a small command-line tool that can be passed a STL file. Then, using my STL Thumbnails, it takes a preview picture of the STL and stores it in PNG format.
Why would you want to do that?
Well, it’s for automation mostly. It can generate a few hundred previews per minute. If you have website where you provide your designs, you’re happy if you can let your server generate previews automatically!
I’ve heard from some companys that they use preview images in their customer management system because these often can’t handle STL natively.
One user wants their printer to display an image of the STL file that’s currently being printed, and stltopng comes in handy there.
Of course it’s also a blessing if you just want to provide a catalog of your STL files for someone else!
How does it work?
First off, it requires my STL Thumbnails being installed.
Then, download stltopng.exe from my website.
If you just want to get an image quickly, drag & drop the STL on stltopng. It should create the image stl.png. Done.
If you want to use it for scripting, call it via
stltopng /res 1000 /png "X:\path\to\image.png" "Y:\path\to\design.stl"
This will create a preview image of approx. 1000×1000 pixels from the given STL at the given path. It returns zero on success. On failure, it writes to stderr and returns a non-zero value.
But the colors! And I’d like to have a rotated view!
You can adjust the colors and the viewing angle via my STL Thumbnail settings in the registry. The background may be black in many images because one of the Windows functions I currently use cannot handle transparency well.
That’s cumbersome to use. And the images aren’t even exactly the size I specified!
I know! An improved version is to come. But here’s the catch: The STL Thumbnails were developed for Windows, and Windows always asks for square images with a centered object from a static angle. In order to specify exact image dimensions, colors, and viewing angle from the command line, my STL Thumbnails must be modified and the updated version must be bundled with stltopng. This requires thorough testing and will take a while. Guess what we have now is better than nothing!
I attached the source code in case someone needs a novel way to call my thumbnails programmatically. (It’s a standard interface that can be used from any C++/.NET/VB program in case you didn’t know.)
stltopng.cpp (7.09 KB)
Maybe it’s useful to someone here. If so, let me know of your problems and suggestions!