# ImageMagick PixelPacket Structure

The PixelPacket structure is used to represent DirectClass color pixels in ImageMagick. If the image is indicated as a PseudoClass image, its DirectClass representation is only valid immediately after calling SyncImage(). If an image is set as PseudoClass and the DirectClass representation is modified, the image should then be set as DirectClass. Use QuantizeImage() to restore the PseudoClass colormap if the DirectClass representation is modified.

The members of the PixelPacket structure are shown in the following table:

PixelPacket Structure Members
Member | Type | Interpretation
RGBColorspace (3) | RGBColorspace + matte (3) | CMYKColorspace
red | Quantum | Red | Red | Cyan
green | Quantum | Green | Green | Magenta
blue | Quantum | Blue | Blue | Yellow
opacity | Quantum | Ignored | Opacity | Black

Notes:

1. Quantum is an unsigned short (MaxRGB=65535) if ImageMagick is built using -DQuantumDepth=16 Otherwise it is an unsigned char (MaxRGB=255).
2. SyncImage() may be used to synchronize the DirectClass color pixels to the current PseudoClass colormap.
3. For pixel representation purposes, all colorspaces are treated like RGBColorspace except for CMYKColorspace.

Image manipulation software that works like magic.