Beispiel #1
0
def _channel_id_to_PIL(channel_id, color_mode):
    if ChannelID.is_known(channel_id):
        if channel_id == ChannelID.TRANSPARENCY_MASK:
            return 'A'
        warnings.warn("Channel %s (%s) is not handled" % (channel_id, ChannelID.name_of(channel_id)))
        return None

    try:
        assert channel_id >= 0
        if color_mode == ColorMode.RGB:
            return 'RGB'[channel_id]
        elif color_mode == ColorMode.CMYK:
            return 'CMYK'[channel_id]
        elif color_mode == ColorMode.GRAYSCALE:
            return 'L'[channel_id]

    except IndexError:
        # spot channel
        warnings.warn("Spot channel %s is not handled" % channel_id)
        return None
Beispiel #2
0
def _channel_id_to_PIL(channel_id, color_mode):
    if ChannelID.is_known(channel_id):
        if channel_id == ChannelID.TRANSPARENCY_MASK:
            return 'A'
        warnings.warn("Channel %s (%s) is not handled" % (channel_id, ChannelID.name_of(channel_id)))
        return None

    try:
        assert channel_id >= 0
        if color_mode == ColorMode.RGB:
            return 'RGB'[channel_id]
        elif color_mode == ColorMode.CMYK:
            return 'CMYK'[channel_id]
        elif color_mode == ColorMode.GRAYSCALE:
            return 'L'[channel_id]

    except IndexError:
        # spot channel
        warnings.warn("Spot channel %s is not handled" % channel_id)
        return None
def _channel_id_to_PIL(channel_id, color_mode):
    if ChannelID.is_known(channel_id):
        if channel_id == ChannelID.TRANSPARENCY_MASK:
            return 'A'
        elif channel_id in (ChannelID.USER_LAYER_MASK,
                            ChannelID.REAL_USER_LAYER_MASK):
            return None
        return None

    try:
        assert channel_id >= 0
        if color_mode == ColorMode.RGB:
            return 'RGB'[channel_id]
        elif color_mode == ColorMode.CMYK:
            return 'CMYK'[channel_id]
        elif color_mode == ColorMode.GRAYSCALE:
            return 'L'[channel_id]

    except IndexError:
        # spot channel
        warnings.warn("Spot channel %s is not handled" % channel_id)
        return None
Beispiel #4
0
 def __repr__(self):
     return "ChannelInfo(id=%s %s, length=%s)" % (
         self.id, ChannelID.name_of(self.id), self.length
     )
Beispiel #5
0
 def __repr__(self):
     return "ChannelInfo(id=%s %s, length=%s)" % (
         self.id, ChannelID.name_of(self.id), self.length)