← SPL reference

image (lib/image.py)

Import and export PNG/JPEG (and other Pillow formats), then apply color and geometry edits. Every edit returns a new image; the source is never mutated. Load with use image; (extensionless: reqFileExtension = False).

Needs Pillow + numpy: pip install 'someProgrammingLanguage[play]' or Pillow and numpy on their own. Check with image.depsOk() (1 / 0). Paths are cwd-relative (no .., no absolute paths). Imports cap at 4096px on the long side.

Import / export

use image;

img.setVar(image.import("photo.png"));
warm.setVar(image.hue(img, 20));
image.export(warm, "edited.png");

No photo on disk? image.demo() builds a colorful test image. Methods work too: img.export("out.png"), img.hue(20), img.width().

Edits (all return a new image)

GUI editor

Play ships a slider editor (hue, saturation, brightness, contrast, exposure, white-balance, gamma, shadows/highlights, vignette, blur/sharpen, plus invert / gray / sepia / flip / rotate). Hold C to compare with the original. Export writes edited.png in the working directory.

use play;
use image;

win <- play.window(1280, 800, "SPL Image Editor");
ed <- play.imageEditor(win);
#comment: or: ed <- play.imageEditor(win, image.import("photo.png"));

Full loop: examples/play/image_editor.spl. Code-only pipeline: examples/image_edit/image_edit.spl.

Implementation: lib/image.py + someProgrammingLanguage/spl_image.py + spl_play/image_editor.py