I’m trying to print a cookie cutter pattern made from a PNG I have. So I use this file in Openscad:

resize([127, 127, 6])
surface("/Users/jason/downloads/fish scale.png", center=true, invert=true);

Of course surfaces in Openscad are slow, but this runs in a tolerable amount of time. I tried to attach a backing to it using a cube, it locks up and does not complete:

cube([127, 127, 3], center = true);

resize([127, 127, 6])
surface("/Users/jason/downloads/fish scale.png", center=true, invert=true);

or…

union() {
cube([127, 127, 3], center = true);

resize([127, 127, 6])
surface("/Users/jason/downloads/fish scale.png", center=true, invert=true);

}

Is there a better way to do this?

Yes, a) scale down the PNG image before importing into OpenSCAD, or b) use some means to convert the image to a scad script or vector shape, e.g. Trace2SCAD, some similar online service, or Inkscape + Export plugin.