def asRGB(self):
        """
        Return image as RGB pixels.

        RGB colour images are passed through unchanged;
        greyscales are expanded into RGB  triplets
        (there is a small speed overhead for doing this).

        An alpha channel in the source image will raise an exception.

        The return values are as for the :meth:`read` method
        except that the *metadata* reflect the returned pixels, not the
        source image.  In particular, for this method
        ``metadata['greyscale']`` will be ``False``.
        """
        width, height, pixels, meta = self.asDirect()
        if meta['alpha']:
            raise Error("will not convert image with alpha channel to RGB")
        if not meta['greyscale']:
            return width, height, pixels, meta
        meta['greyscale'] = False
        newarray = (newBarray, newHarray)[meta['bitdepth'] > 8]

        def iterrgb():
            for row in pixels:
                a = newarray(3 * width)
                for i in range(3):
                    a[i::3] = row
                yield a
        return width, height, iterrgb(), meta
def asRGB ( self ) : width , height , pixels , meta = self . asDirect ( ) if meta [ 'alpha' ] : raise Error ( "will not convert image with alpha channel to RGB" ) if not meta [ 'greyscale' ] : return width , height , pixels , meta meta [ 'greyscale' ] = False newarray = ( newBarray , newHarray ) [ meta [ 'bitdepth' ] > 8 ] def iterrgb ( ) : for row in pixels : a = newarray ( 3 * width ) for i in range ( 3 ) : a [ i : : 3 ] = row yield a return width , height , iterrgb ( ) , meta
Return image as RGB pixels.

        RGB colour images are passed through unchanged;
        greyscales are expanded into RGB  triplets
        (there is a small speed overhead for doing this).

        An alpha channel in the source image will raise an exception.

        The return values are as for the :meth:`read` method
        except that the *metadata* reflect the returned pixels, not the
        source image.  In particular, for this method
        ``metadata['greyscale']`` will be ``False``.