c4d.bitmaps.ColorProfileConvert

class c4d.bitmaps.ColorProfileConvert
A helper class to convert the ColorProfile of bitmaps.

See also

Color Profiles

New in version R17.032.

Methods Signatures

ColorProfileConvert.__init__()

ColorProfileConvert.PrepareTransform()

Prepares the color conversion i.e. checks if a conversion is needed.

ColorProfileConvert.Convert()

Converts the color profiles of the pixel data.

Methods Documentation

ColorProfileConvert.__init__(self)
ColorProfileConvert.PrepareTransform(self, srccolormode, srcprofile, dstcolormode, dstprofile, bgr)
Prepares the color conversion i.e. checks if a conversion is needed.
A conversion is only necessary if True is returned. Two identical color spaces will return False.
Parameters
  • srccolormode (int) –

    The source color mode:

    COLORMODE_ILLEGAL

    Illegal 8-bit mode.

    COLORMODE_ALPHA

    Only 8-bit alpha channel.

    COLORMODE_GRAY

    8-bit grayscale channel.

    COLORMODE_AGRAY

    8-bit grayscale channel with 8-bit alpha.

    COLORMODE_RGB

    8-bit RGB channels.

    COLORMODE_ARGB

    8-bit RGB channels with 8-bit alpha.

    COLORMODE_CMYK

    8-bit CMYK channel.

    COLORMODE_ACMYK

    8-bit CMYK channel with 8-bit alpha.

    COLORMODE_MASK

    8-bit grayscale map as mask.

    COLORMODE_AMASK

    8-bit grayscale map as mask with 8-bit alpha.

    COLORMODE_ILLEGALw

    Illegal 16-bit mode.

    COLORMODE_GRAYw

    16-bit grayscale channel.

    COLORMODE_AGRAYw

    16-bit grayscale channel with 16-bit alpha.

    COLORMODE_RGBw

    16-bit RGB channels.

    COLORMODE_ARGBw

    16-bit RGB channels with 16-bit alpha.

    COLORMODE_MASKw

    16-bit grayscale map as mask with 16-bit alpha.

    COLORMODE_ILLEGALf

    Illegal 32-bit mode.

    COLORMODE_GRAYf

    32-bit floating point grayscale channel.

    COLORMODE_AGRAYf

    32-bit floating point grayscale channel with floating point alpha.

    COLORMODE_RGBf

    32-bit floating point RGB channels.

    COLORMODE_ARGBf

    32-bit floating point RGB channels with floating point alpha.

    COLORMODE_MASKf

    32-bit floating point grayscale map as mask.

  • srcprofile (c4d.bitmaps.ColorProfile) – The source color profile.

  • dstcolormode (c4d.bitmaps.ColorProfile) –

    The destination color mode:

    COLORMODE_ILLEGAL

    Illegal 8-bit mode.

    COLORMODE_ALPHA

    Only 8-bit alpha channel.

    COLORMODE_GRAY

    8-bit grayscale channel.

    COLORMODE_AGRAY

    8-bit grayscale channel with 8-bit alpha.

    COLORMODE_RGB

    8-bit RGB channels.

    COLORMODE_ARGB

    8-bit RGB channels with 8-bit alpha.

    COLORMODE_CMYK

    8-bit CMYK channel.

    COLORMODE_ACMYK

    8-bit CMYK channel with 8-bit alpha.

    COLORMODE_MASK

    8-bit grayscale map as mask.

    COLORMODE_AMASK

    8-bit grayscale map as mask with 8-bit alpha.

    COLORMODE_ILLEGALw

    Illegal 16-bit mode.

    COLORMODE_GRAYw

    16-bit grayscale channel.

    COLORMODE_AGRAYw

    16-bit grayscale channel with 16-bit alpha.

    COLORMODE_RGBw

    16-bit RGB channels.

    COLORMODE_ARGBw

    16-bit RGB channels with 16-bit alpha.

    COLORMODE_MASKw

    16-bit grayscale map as mask with 16-bit alpha.

    COLORMODE_ILLEGALf

    Illegal 32-bit mode.

    COLORMODE_GRAYf

    32-bit floating point grayscale channel.

    COLORMODE_AGRAYf

    32-bit floating point grayscale channel with floating point alpha.

    COLORMODE_RGBf

    32-bit floating point RGB channels.

    COLORMODE_ARGBf

    32-bit floating point RGB channels with floating point alpha.

    COLORMODE_MASKf

    32-bit floating point grayscale map as mask.

  • dstprofile (c4d.bitmaps.ColorProfile) – The destination color profile.

  • bgr (bool) – True to swap the RGB channels. Only necessary when working directly with Windows bitmaps.

Return type

bool

Returns

True a conversion is necessary, otherwise False.

ColorProfileConvert.Convert(self, src, dst, cnt, skipInputComponents, skipOutputComponents)

Converts the color profiles of the pixel data.

Parameters
  • src (bytes) – The source pixel buffer.

  • dst (bytes) – The destination pixel buffer.

  • cnt (int) – The number of pixels to convert.

  • skipInputComponents (bool) –

    The number of bytes to skip in the source buffer after each converted pixel. For instance a RGB pixel contains 3 bytes.
    After conversion the number of skipInputComponents bytes is added to the source pointer.

  • skipOutputComponents (bool) –

    The number of bytes to skip in the destination buffer after each converted pixel. For instance a RGB pixel contains 3 bytes.
    After conversion the number of SkipOutputComponents bytes is added to the destination pointer.