Skip to content

Duotone

Converts the image to two tones, mapping dark and light areas to two colors.

imgproxy: duotone (alias dt) · Availability: imgproxy Pro only

use SomehowDigital\ImgProxy\Url;
use SomehowDigital\ImgProxy\Option\Duotone;
$url = Url::create()
->source('https://example.com/image.jpg')
->options(new Duotone(0.8, ['000000', 'ffffff']));
$url->build();
// _/dt:0.8:000000:ffffff/plain/https%3A%2F%2Fexample.com%2Fimage.jpg

The option appears in the URL as dt:0.8:000000:ffffff.

Parameter Type Default Description
$intensity float required From 0 to 1.
$colors array — Two hexadecimal colors: the dark one, then the light one.

A dash means the argument can be left out. Trailing arguments that are left out or null are dropped from the URL, while a null before a given argument leaves an empty slot, so the following arguments keep their position.

imgproxy reference