PGM to OpenSCAD surface
thingiverse
This Python script converts ASCII formatted PGM files to "surface" data for OpenSCAD. Requiring v2.7 of Python and numpy, it's simple and quick to use. To convert, run the script with your desired PGM file as an argument, followed by the output filename, and optionally a depth value. In OpenSCAD, import the generated DAT file using the "surface" command, adjusting for top-bottom and left-right flipping. Note that large surfaces may crash OpenSCAD when generating STL files. Make sure your PGM file has no compression and is ASCII formatted. Convert your digital image to a PGM file in your preferred photo editor before running the script, ensuring it's flipped as desired. The depth value can be adjusted for different surface heights, and negative images can be used for "cookie cutter" molds.
With this file you will be able to print PGM to OpenSCAD surface with your 3D printer. Click on the button and save the file on your computer to work, edit or customize your design. You can also find more 3D designs for printers on PGM to OpenSCAD surface.