1. NodeBox 1
    1. Homepage
    2. NodeBox 3Node-based app for generative design and data visualization
    3. NodeBox OpenGLHardware-accelerated cross-platform graphics library
    4. NodeBox 1Generate 2D visuals using Python code (Mac OS X only)
  2. Gallery
  3. Documentation
  4. Forum
  5. Blog

canvas.export issues

Posted by Peter N Lewis on Mar 06, 2009

The canvas.export appears to have serious issues. I presume it is related to the "calling CIContext().drawImage" known issues, and certainly exporting a complex canvas takes forever, especially after they build up for a while, and lock the Mac up quite effectively, and produce incorrect results.

In my case, I am generating a set of 6 512x512 images, each constructed from a variety of relatively complex canvases, however the canvases are added in as:

outcanvas.append( canvas.flatten() )
such that there should only be about a dozen layers in the output canvas. But performance results were still terrible and after the first couple of output images the results were also totally broken.

However, in my case I solved the issue by changing from:
outputcanvas.export( "Whatever.png" )
to
oc = coreimage.canvas( WIDTH, HEIGHT  )
    oc.append( outputcanvas.flatten() )
    oc.export( "Whatever.png" )
Performance dramatically improved and correct images resulted. This might be helpful in debugging, or alternatively, might be helpful for others with problems exporting coreimage images.