Pillow - JakeTurner616/pygame-lua-bindings GitHub Wiki

Python pillow functions

load_image_from_pil(image_path)

Load an image using Pillow and store its pixel data as a Pygame surface.

Parameters:

  • image_path: The path to the image file.

Returns: A Pygame surface containing the image data.

get_pixel_color(pixels, x, y)

Get the color of a specific pixel.

Parameters:

  • pixels: The pixel data from a Pillow image.
  • x: The x-coordinate of the pixel.
  • y: The y-coordinate of the pixel.

Returns: A dictionary with the keys r, g, and b representing the red, green, and blue components of the pixel color.

get_image_data(image_path)

Get the pixel data of an image as a Lua table.

Parameters:

  • image_path: The path to the image file.

Returns: A dictionary with the keys width, height, and pixels representing the width and height of the image and the pixel data.