Sizing, Cropping & Drivers
InterventionImage extends ProcessWire’s Pageimage with full Intervention Image v4.4 transformations while honoring ProcessWire’s built-in focal point (focus()) and zoom coordinates.
Sizing, Cropping, Contain & Watermarks
Section titled “Sizing, Cropping, Contain & Watermarks”<?php namespace ProcessWire;
/** @var Pageimage $image */
// 1. Named preset (aspectRatio + optional columnWidth fraction)$card = $image->size('landscape-1-2', ['format' => 'avif', 'quality' => 82]);
// 2. Explicit dimensions with focal-point crop, trim, and filters$styled = $image->size(800, 600, [ 'format' => 'webp', 'quality' => 85, 'cropping' => 'center', // true|'center'|false|'contain'|'north'|'southeast'|'x100y200'|[100, 200] 'trim' => 10, // Trim uniform borders (0..100) 'sharpening' => 'medium', // 'none'|'soft'|'medium'|'strong' (or numeric 'sharpen' => 0..100) 'blur' => 0, // Gaussian blur (0..100) 'brightness' => 5, // -100..100 'contrast' => 5, // -100..100 'gamma' => 1.0, // 0.1..10.0 'colorize' => [0, 0, 0], // RGB shift (-100..100) 'grayscale' => false, 'invert' => false, 'pixelate' => 0, 'reduceColors' => 0, // 1..256]);
// 3. Explicit rectangular crop (x, y, width, height)$cropped = $image->crop(100, 50, 600, 400, ['format' => 'webp']);
// 4. Letterbox contain with hex background fill$contained = $image->contain(800, 600, 'ffffff');
// 5. Composite a watermark Pageimage (position, opacity, offsetX, offsetY, maxWidth, maxHeight)$watermarked = $image->watermark($logoPageimage, 'bottom-right', 60, 20, 20, 1200, 800);Custom Intervention Image v4.4 Modifiers
Section titled “Custom Intervention Image v4.4 Modifiers”Pass any Intervention\Image\Interfaces\ModifierInterface instance or typed closure via 'modifiers' when you need specialized pixel pipelines:
use Intervention\Image\Interfaces\ImageInterface;
$custom = $image->size(1200, 800, [ 'format' => 'webp', 'modifiers' => [ static fn (ImageInterface $img): ImageInterface => $img->sharpen(15), ],]);Accessing the Underlying ImageManager
Section titled “Accessing the Underlying ImageManager”For advanced one-off operations outside Pageimage::size(), call $modules->get('InterventionImage')->manager() to obtain the active Intervention\Image\ImageManager bound to the healthiest detected driver (vips, imagick, or gd).