Effects
Sometimes you want to do more than resize and compress. The builder provides methods for blur, sharpen, pixelate, rotation, background color, and watermarks — useful for everything from subtle product photography polish to privacy blurring and branded watermarks.
Blur
Apply a Gaussian blur. The sigma parameter controls the blur radius — higher values produce a stronger effect:
Imgproxy::image($source)->blur(1.5)->url();
// bl:1.5Values between 0.1 and 10 are typical. Use low values for subtle softening and high values for obfuscation or background effects:
// Subtle softening
Imgproxy::image($source)->blur(0.5)->url();
// Strong blur for privacy
Imgproxy::image($source)->blur(8)->url();Sharpen
Apply a sharpening filter. The sigma parameter controls the mask size — as an approximate guideline, use 0.5 for 4 px/mm, 1.0 for 12 px/mm, and 1.5 for 16 px/mm:
Imgproxy::image($source)->sharpen(0.5)->url();
// sh:0.5Recommended values are between 0.1 and 3:
// Subtle sharpening for product photos
Imgproxy::image($source)->sharpen(0.5)->url();
// Strong sharpening for detailed images
Imgproxy::image($source)->sharpen(2.0)->url();Pixelate
Apply a pixelation effect. The size parameter sets the side length of each pixel block:
Imgproxy::image($source)->pixelate(4)->url();
// pix:4Rotate
Rotate the image by a multiple of 90 degrees. Non-multiples or negative values throw InvalidArgumentException:
Imgproxy::image($source)->rotate(90)->url();
// rot:90
Imgproxy::image($source)->rotate(180)->url();
// rot:180
Imgproxy::image($source)->rotate(270)->url();
// rot:270Auto Rotate
Automatically rotate the image based on the EXIF orientation tag. When enabled, images from cameras and phones are displayed in the correct orientation:
Imgproxy::image($source)->autoRotate()->url();
// ar:1
Imgproxy::image($source)->withoutAutoRotate()->url();
// ar:0Background
Fill the background with a color when the image is extended, padded, or has transparency. Accepts a 3 or 6 digit hex value with an optional leading #:
Imgproxy::image($source)->background('#f8fafc')->url();
// bg:f8fafc
Imgproxy::image($source)->background('ffffff')->url();
// bg:ffffffWatermark
Overlay a watermark image. The first argument is opacity (0–1). Position, offset, and scale are optional:
use Imsus\LaravelImgproxy\Enums\WatermarkPosition;
// 50% opacity, south-east corner, 10px offsets
Imgproxy::image($source)
->watermark(0.5, WatermarkPosition::SouthEast, 10, 10)
->url();
// wm:0.5:soea:10:10When you need only position and offsets without an explicit scale:
// Center (default), 5px horizontal offset, 10px vertical offset
Imgproxy::image($source)
->watermark(0.8, WatermarkPosition::Center, 5, 10)
->url();
// wm:0.8:ce:5:10With a custom scale:
// 70% opacity, repeat tiling, scale factor 2
Imgproxy::image($source)
->watermark(0.7, WatermarkPosition::Repeat, 0, 0, 2)
->url();
// wm:0.7:re:0:0:2TIP
When you pass offsets or scale without an explicit position, the position defaults to Center.
Available Watermark Positions
| Value | Segment | Description |
|---|---|---|
ce | wm:…:ce | Center (default) |
no | wm:…:no | North (top edge) |
so | wm:…:so | South (bottom edge) |
ea | wm:…:ea | East (right edge) |
we | wm:…:we | West (left edge) |
nowe | wm:…:nowe | North-west (top-left) |
noea | wm:…:noea | North-east (top-right) |
sowe | wm:…:sowe | South-west (bottom-left) |
soea | wm:…:soea | South-east (bottom-right) |
re | wm:…:re | Repeat and tile the watermark |
Combining Effects
Chain effects in any order — they are appended as segments in call order:
$url = Imgproxy::image($source)
->blur(1.5)
->sharpen(0.5)
->rotate(90)
->background('#f8fafc')
->url();
// bl:1.5/sh:0.5/rot:90/bg:f8fafcSee also: Usage, API Reference