Domanda

In GraphicsMagick i can export an image in all kinds of formats. E.g. RGB. by writing

Blob blob( imageContent, imageSize );
image.magick("RGB");
image.write( &blob );

Exporting in RGBA seems unsupported. What is the easiest and fastest way ? Using ColorMatrix seems a little cumbersome.

È stato utile?

Soluzione

I did not find a way to write into a Blob yet as defined by GrapicsMagick but this works:

Image image("test.jpg");

int rows = image.rows();
int cols = image.columns();
int imageStride = cols*4;
size_t imageSize = rows*imageStride;
LPBYTE imageContent = (LPBYTE) malloc(imageSize);

image.write( 0,0, cols, rows, "BGRA", CharPixel, imageContent );
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top