image_converter.py

Image Converter - Embedded Image Management and Conversion System
LOCATION: lunaengine/utils/image_converter.py
DESCRIPTION: Comprehensive image conversion and embedding system

Probably you will never use this shit :)

class ImageConverter

Description

Converts images to Python code for embedding in games
Uses Pygame for image loading - NO PILLOW REQUIRED

Methods
def image_to_python_code(image_path: str, output_var_name: str = 'image_data', max_size: Optional[Tuple[int, int]] = None, method: str = 'compressed', quality: float = 1.0) -> str
Convert an image to Python code with quality compression

Args:
   image_path: Path to the image file
   output_var_name: Name for the output variable
   max_size: Maximum dimensions (width, height)
   method: Conversion method ('pixel_array', 'base64', 'compressed')
   quality: Image quality (1.0 = original, 0.5 = half size, 0.25 = quarter size)
def _resize_surface(surface: pygame.Surface, target_size: Tuple[int, int]) -> pygame.Surface
No documentation
def _to_pixel_array(surface: pygame.Surface, width: int, height: int, var_name: str) -> str
No documentation
def _to_base64(surface: pygame.Surface, width: int, height: int, var_name: str) -> str
No documentation
def _to_compressed_optimized(surface: pygame.Surface, width: int, height: int, var_name: str) -> str
No documentation
def create_image_from_code(image_data: dict) -> pygame.Surface
No documentation
def _from_pixel_array(image_data: dict) -> pygame.Surface
No documentation
def _from_encoded_data(image_data: dict) -> pygame.Surface
No documentation

class EmbeddedImage

Description

Helper class for working with embedded images

Methods
def __init__(self: Any, image_data: dict) -> Any
No documentation
def surface(self: Any) -> pygame.Surface
No documentation
def width(self: Any) -> int
No documentation
def height(self: Any) -> int
No documentation
def draw(self: Any, renderer: Any, x: int, y: int) -> Any
No documentation
Back to Utils Module