Ejemplo n.º 1
0
    def test_output_RGB(self):
        """
        Export EncodeRGB() method result to file
        """
        image = BitmapHandler(PNG_BITMAP_DATA, BitmapHandler.RGB, IMAGE_WIDTH,
                              IMAGE_HEIGHT, IMAGE_WIDTH * 3)
        result = encode.EncodeRGB(image)

        file(ENCODE_FILENAME.format("RGB"), "wb").write(result.data)
Ejemplo n.º 2
0
    def test_output_RGB(self):
        """
        Export EncodeRGB() method result to file
        """
        image = BitmapHandler(
            PNG_BITMAP_DATA, BitmapHandler.RGB,
            IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_WIDTH * 3
        )
        result = encode.EncodeRGB(image)

        file(ENCODE_FILENAME.format("RGB"), "wb").write(result.data)
Ejemplo n.º 3
0
    def test_output_BGR(self):
        """
        Export EncodeBGR() method result to file
        """
        # Convert to RGBA
        size = IMAGE_WIDTH * IMAGE_HEIGHT
        bitmap = bytearray(size * 3)

        for i in range(size):
            bitmap[i * 3] = PNG_BITMAP_DATA[i * 3 + 2]
            bitmap[i * 3 + 1] = PNG_BITMAP_DATA[i * 3 + 1]
            bitmap[i * 3 + 2] = PNG_BITMAP_DATA[i * 3]

        image = BitmapHandler(bitmap, BitmapHandler.BGR, IMAGE_WIDTH,
                              IMAGE_HEIGHT, IMAGE_WIDTH * 3)

        # Save image
        result = encode.EncodeBGR(image)

        file(ENCODE_FILENAME.format("BGR"), "wb").write(result.data)
Ejemplo n.º 4
0
    def test_output_BGR(self):
        """
        Export EncodeBGR() method result to file
        """
        # Convert to RGBA
        size = IMAGE_WIDTH * IMAGE_HEIGHT
        bitmap = bytearray(size * 3)

        for i in range(size):
            bitmap[ i * 3 ] = PNG_BITMAP_DATA[ i * 3 + 2 ]
            bitmap[ i * 3 + 1 ] = PNG_BITMAP_DATA[ i * 3 + 1 ]
            bitmap[ i * 3 + 2 ] = PNG_BITMAP_DATA[ i * 3 ]

        image = BitmapHandler(
            bitmap, BitmapHandler.BGR,
            IMAGE_WIDTH, IMAGE_HEIGHT, IMAGE_WIDTH * 3
        )

        # Save image
        result = encode.EncodeBGR(image)

        file(ENCODE_FILENAME.format("BGR"), "wb").write(result.data)