[OpenSCAD] Surface() from PNG and difference()

Ed Nisley ed.nisley at pobox.com
Wed Apr 29 14:38:33 EDT 2015

On 04/29/2015 01:01 PM, MLewis wrote:
> logox = 587;
> logoy = 623;

There's the problem: too many pixels.

In round numbers, anything over about 300x300 pixels produces too many 
polygons / faces, causing OpenSCAD to grind to a halt while chewing up 
all available memory & swap space in a vain attempt to perform CSG.

Scaling the PNG image by 1/8 = 75x81 ran for 9 s and by 1/4 = 150x163 
ran for 40 s. With more patience, 300x326 would eventually finish.

The PNG is transparent and the logo ran right up to the edges. I laid it 
over a white background and added a thin white border, which eliminated 
the "degenerate polygon" complaints.

The "invert=true" option produces nasty undercuts on the 
reduced-resolution images, because the grayscale works the wrong way. I 
think you'll get better results with a white logo on a black background, 
regardless of the resolution.

I found much of that out the hard way while making 3D printed cookie 


Gritty resolution sufficed for those...


More information about the Discuss mailing list