Deep Writer

The ‘DeepWrite’ node supports different file formats through the use of ‘DeepWriter’ plug-ins, similar to the way the ‘Write’ node uses ‘Writer’ plug-ins.

A deep file writer inherits from the class DD::Image::DeepWriter, and registers itself in the symbol table by creating a DD::Image::DeepWriter::Description. For a full example, see cdfWriterDeep.cpp. The skeleton of this is:

class cdfWriter : public DeepWriter
  cdfWriter(DeepWriterOwner* o) : DeepWriter(o)

  void knobs(Knob_Callback f)

  void execute()
    const DeepInfo& di = input()->deepInfo();
    const DD::Image::ChannelSet& channels = di.channels();

    const int l =;
    const int r =;
    const int b =;
    const int t =;

    input()->deepRequest(, channels);

    FILE* f = openFile();

    for (int y = b; y < t; y++) {
      DeepPlane plane;
      if (!input()->deepEngine(y, l, r, channels, plane)) {

      // actually do something with the pixels from plane


static DeepWriter* build(DeepWriterOwner* iop)

static const DeepWriter::Description d("cdf\0", build);

The function DeepWriter::execute() is invoked for each frame. DeepWriters (or Readers) do not currently support files containing more than one frame, so you’ll need a new filename each time.

From execute(), DeepWriter::input() returns the DeepOp input build at the right frame. This is then validated and requested before data can be fetched from it. The above example calls ::fillCache() to ensure that the processing is done using worker threads - if deepEngine() is called from this context without having done this step, the main work is done solely in the thread that execute() is called from.

The filename to write to is accessible from DeepWriterOwner::filename(). The DeepWriter provides helper functions, DeepWriter::openFile() and DeepWriter::closeFile() that automatically uses a temporary file and renames.

If the DeepWriter requires file-format-specific knobs, it can provide these in the knobs() function, as a regular Op would. These knobs are deleted and replaced as the user changes the file format.