Domanda

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?

È stato utile?

Soluzione 2

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");

Altri suggerimenti

I don't think that your answer is a good one. It it is working by accident. Your blob data is likely to be in some other format than DPX. Specifying 'SDPX' (an unsupported format specification) allowed the file format detection to automatically work and select the correct format.

Using

enter code herMagick::Blob blob(dataBuffer, dataBufferSize);
image.read(blob);

should then be sufficient. Most image file formats do not require specifying the format or the depth.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top