Example #1
0
 def __repr__(self):
     return "PsdHeader(number_of_channels=%s, height=%s, width=%s, depth=%s, color_mode=%s)" % (
         self.number_of_channels,
         self.height,
         self.width,
         self.depth,
         ColorMode.name_of(self.color_mode),
     )
Example #2
0
 def __repr__(self):
     return (
         "PsdHeader(version=%s, number_of_channels=%s, height=%s, "
         "width=%s, depth=%s, color_mode=%s)" % (
             self.version, self.number_of_channels, self.height,
             self.width, self.depth, ColorMode.name_of(self.color_mode)
         )
     )
def _validate_header(header):
    """
    Validates header and returns (depth, mode) tuple.
    """
    if LoadedImage is None or packbits is None:
        raise Exception("This module requires `pymaging` and `packbits` packages.")

    if header.color_mode != ColorMode.RGB:
        raise NotImplementedError(
            "This color mode (%s) is not supported yet" % ColorMode.name_of(header.color_mode)
        )

    mode = _get_mode(header.number_of_channels)
    if mode is None:
        raise NotImplementedError("This number of channels (%d) is unsupported for this color mode (%s)" % (
                         header.number_of_channels, header.color_mode))

    if header.depth != 8:
        raise NotImplementedError("Only 8bit images are currently supported with pymaging.")

    return 8, mode
Example #4
0
def _validate_header(header):
    """
    Validates header and returns (depth, mode) tuple.
    """
    if LoadedImage is None or packbits is None:
        raise Exception(
            "This module requires `pymaging` and `packbits` packages.")

    if header.color_mode != ColorMode.RGB:
        raise NotImplementedError("This color mode (%s) is not supported yet" %
                                  ColorMode.name_of(header.color_mode))

    mode = _get_mode(header.number_of_channels)
    if mode is None:
        raise NotImplementedError(
            "This number of channels (%d) is unsupported for this color mode"
            " (%s)" % (header.number_of_channels, header.color_mode))

    if header.depth != 8:
        raise NotImplementedError(
            "Only 8bit images are currently supported with pymaging.")

    return 8, mode