Skip to content

[13.x] Adds dominant color detection to image driver - #60932

Merged
taylorotwell merged 2 commits into
laravel:13.xfrom
dr-codswallop:feat/dominant-color-as-bg-option
Jul 30, 2026
Merged

[13.x] Adds dominant color detection to image driver#60932
taylorotwell merged 2 commits into
laravel:13.xfrom
dr-codswallop:feat/dominant-color-as-bg-option

Conversation

@dr-codswallop

Copy link
Copy Markdown
Contributor

Introduces support for using the dominant (average) color of an image as a background option in image transformations, computed by downsampling image to a 1x1 pixel.

Adds a new method dominantColor() method to the Driver contract and Image class returning the average color of an image as a hex string.

Also adds a 'dominant' value for the background parameter of contain() and rotate() transformations, which automatically fills letterbox/rotation areas with the image's dominant color.

Adds a `dominantColor()` method to the `Driver` contract and `Image` class that returns the average color of an image as a hex string, computed by downsampling image to a single pixel.

Also introduces a `'dominant'` value for the `background` parameter of `contain()` and `rotate()` transformations, which automatically fills letterbox/rotation areas with the image's dominant color.
@dr-codswallop dr-codswallop changed the title Adds dominant color detection to image driver [13.x] Adds dominant color detection to image driver Jul 30, 2026
@taylorotwell
taylorotwell merged commit 2fccdeb into laravel:13.x Jul 30, 2026
38 of 53 checks passed
dr-codswallop added a commit to dr-codswallop/docs that referenced this pull request Jul 31, 2026
…ethods

Documents the dominant color support added in laravel/framework#60932.

The `contain` and `rotate` methods now accept `'dominant'` as a background value, and images expose a `dominantColor()` method that returns the average color as a hex string.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants