from PIL import Image
from OpenGL.GL import *
import numpy as np

# read and save image
def save_image(width, height, image_name):
    buffer = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE);

    image = Image.frombytes(mode="RGB", size=(width, height), data=buffer)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)

    image.save(image_name)

def load_image(imagePath):
    image = Image.open(imagePath)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    img_data = np.array(list(image.getdata()), np.uint8)

    width, height = image.size
    return img_data, width, height
f7d662066a09d3d7d6986ccddfe3d6bee0b59373
<mask token>

<mask token>


def save_image(width, height, image_name):
    buffer = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
    image = Image.frombytes(mode='RGB', size=(width, height), data=buffer)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    image.save(image_name)


<mask token>

<mask token>


def save_image(width, height, image_name):
    buffer = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
    image = Image.frombytes(mode='RGB', size=(width, height), data=buffer)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    image.save(image_name)


def load_image(imagePath):
    image = Image.open(imagePath)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    img_data = np.array(list(image.getdata()), np.uint8)
    width, height = image.size
    return img_data, width, height

from PIL import Image
from OpenGL.GL import *
import numpy as np


def save_image(width, height, image_name):
    buffer = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE)
    image = Image.frombytes(mode='RGB', size=(width, height), data=buffer)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    image.save(image_name)


def load_image(imagePath):
    image = Image.open(imagePath)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    img_data = np.array(list(image.getdata()), np.uint8)
    width, height = image.size
    return img_data, width, height

from PIL import Image
from OpenGL.GL import *
import numpy as np

# read and save image
def save_image(width, height, image_name):
    buffer = glReadPixels(0, 0, width, height, GL_RGB, GL_UNSIGNED_BYTE);

    image = Image.frombytes(mode="RGB", size=(width, height), data=buffer)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)

    image.save(image_name)

def load_image(imagePath):
    image = Image.open(imagePath)
    image = image.transpose(Image.FLIP_TOP_BOTTOM)
    img_data = np.array(list(image.getdata()), np.uint8)

    width, height = image.size
    return img_data, width, height