Python convert rgb to rgba

15 Python code examples are found related to " convert rgb to rgba". You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example.
Example 1
Source File: png.py    From script.module.urlresolver with GNU General Public License v2.0 6 votes vote down vote up
def convert_rgb_to_rgba(self, row, result):
        """
        Convert an RGB image to RGBA.

        This method assumes the alpha channel in result is already
        correctly initialized.
        """
        for i in range(len(row) // 3):
            for j in range(3):
                result[(4 * i) + j] = row[(3 * i) + j] 
Example 2
Source File: png.py    From blenderseed with MIT License 5 votes vote down vote up
def convert_rgb_to_rgba(row, result):
            """Convert an RGB image to RGBA. This method assumes the
            alpha channel in result is already correctly initialized.
            """
            for i in range(3):
                result[i::4] = row[i::3]