Laravel 13.24 adds dominantColor() to the Image API for extracting the primary color of an image, plus native support for HEIC and AVIF formats.
Extracting a dominant color for UI placeholders or background tints is built directly into Laravel's Image API. Laravel 13.24 also adds native decoding for Apple HEIC and modern AVIF images out of the box.
Code Example
use Illuminate\Support\Facades\Image;
// 1. Extract dominant color (returns hex string like '#8a6f4c')
$color = Image::read($path)->dominantColor();
// 2. Read and convert iPhone HEIC or AVIF images natively
$jpeg = Image::read(storage_path('app/photos/photo.heic'))
->toJpeg();
Key Benefits
dominantColor(): Resizes to a single pixel internally and returns a hex string (#rrggbbaafor images with alpha channels).- Format Flexibility: iPhone
.heicphotos and.avifweb formats work natively through standardImage::read(). - Driver Requirements: HEIC decoding requires the Imagick extension with the HEIF delegate. AVIF works with GD (compiled with libavif) or Imagick.
Tags:
Laravel Image Media