ImageMagick RunlengthPacket Structure

The RunlengthPacket 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 RunlengthPacket structure are shown in the following table:
 
RunlengthPacket Structure Members
Member
Type
Interpretation
RGBColorspace (4)
RGBColorspace + matte (4) 
CMYKColorspace
red Quantum Red Red Cyan
green Quantum Green Green Magenta
blue Quantum Blue Blue Yellow
length Quantum Run Length Run length Run length
index unsigned short Index into image colormap(2) Alpha Black

Notes:

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