load_image()

Load an image file and populate image metadata (width, height, format).

load_image(filename)

Parameters

Returns

A binary value containing the image data with populated metadata:

Description

Loads an image file and automatically decodes it to extract width and height information. The metadata is immediately available on the returned binary value.

This is a convenience wrapper around load_binary() that adds image metadata extraction.

Path Resolution

Same as load(). See Files, Modules, and Paths for the full table of path roots.

Format Support

Supports PNG, JPEG, and GIF formats. The format is automatically detected and populated in metadata.

Examples

Load and inspect image dimensions

img = load_image("photo.png")
print("Size:", img.width, "x", img.height)
print("Format:", img.format)

Load and scale image

img = load_image("original.jpg")
scaled = scale_image(img, 800, 600, "fit")
save_image(scaled, "scaled.jpg")

Load and crop

img = load_image("landscape.png")
cropped = crop_image(img, 100, 100, 400, 400)
save_image(cropped, "cropped.png")

See Also