Search code examples
graphicsmagick

Load raw memory blob in DPX format with Graphicsmagick


I have a library that generates a Big Endian 10-bit DPX image in a memory buffer. It's just the raw 10-bit RGB data, though, with no headers. I'm trying to load this data into an instance of Magick::Image like this:

Magick::Blob blob(dataBuffer, dataBufferSize;
image.read(blob, Magick::Geometry(width, height), 10 /*bits*/, "DPX");

This throws the following exception, though: Magick: Improper image header ()

Is it possible to load a raw DPX into a Magick::Image?


Solution

  • Figured out my own answer here. I took a look at the DPX loading source and found out for this case this line:

    image.read(blob, Magick::Geometry(width, height), 10 /*bits*/, "DPX");
    

    should be:

    image.read(blob, Magick::Geometry(width, height), 10 /*bits*/, "SDPX");