Page 1 of 1

PixelPacket color format

Posted: 2008-04-15T05:12:20-07:00
by nicolas1
Hello,

What is format and alignment of data (PixelPacket ) accessed by AcquireImagePixels? I have some problems with transparency using buffer returned by AcquireImagePixels. Areas with transparent color is black. (Q==8)

regards,

Re: PixelPacket color format

Posted: 2008-04-15T05:58:16-07:00
by magick
The PixelPacket structure is defined in magick/pixel.h and is defined as follows:

Code: Select all

typedef struct _PixelPacket
{
#if defined(MAGICKCORE_WORDS_BIGENDIAN)
  Quantum
    red,
    green,
    blue,
    opacity;
#else
  Quantum
    blue,
    green,
    red,
    opacity;
#endif
} PixelPacket;
Where Quantum is unsigned char for the Q8 version of ImageMagick.

Re: PixelPacket color format

Posted: 2008-06-06T14:25:23-07:00
by nicolas1
Is it possible to change order of pixelpacket components? It is necessary to use buffer in third-party software without making conversion.
Is it possible to make opacity as 255-opacity (255 means maximum component value)?

Re: PixelPacket color format

Posted: 2008-06-06T14:31:24-07:00
by magick
The pixel component order does not matter to ImageMagick. Change it in the header and compile / install. Unfortunately the only way to get / set alpha is with (QuantumRange - opacity).