Skip to content

[13.x] Add HEIC and additional AVIF support - #60922

Merged
taylorotwell merged 3 commits into
laravel:13.xfrom
riasvdv:feature/avif-heic-support
Aug 2, 2026
Merged

[13.x] Add HEIC and additional AVIF support#60922
taylorotwell merged 3 commits into
laravel:13.xfrom
riasvdv:feature/avif-heic-support

Conversation

@riasvdv

@riasvdv riasvdv commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Summary

Illuminate\Image currently exposes AVIF output through Image::toAvif(), but rejects AVIF inputs before they reach Intervention Image. HEIC and HEIF inputs are rejected in the same way, and HEIC output is not exposed despite Intervention providing an encoder. This adds first-class AVIF input and HEIC input/output support.

  • AVIF, HEIC, and HEIF inputs
  • Image::toHeic()
  • Image::optimize('heic')
  • Image::optimize('heif'), normalized to HEIC output
  • AVIF, HEIC, and HEIF support in the image validation rule
use Illuminate\Support\Facades\Image;

Image::fromUpload($request->file('photo'))
    ->usingImagick()
    ->cover(1200, 800)
    ->toAvif()
    ->quality(80)
    ->store('photos');

Image::fromPath(storage_path('app/photo.heic'))
    ->usingImagick()
    ->toHeic()
    ->quality(80)
    ->store('photos'); // stored with the canonical .heic extension

Also updates Image::extension() to recognize AVIF and HEIC/HEIF MIME aliases. HEIF output aliases are normalized to the canonical .heic extension and image/heic MIME type. HEIC processing requires an Imagick installation with HEIC codec support.

@github-actions

Copy link
Copy Markdown

Thanks for submitting a PR!

Note that draft PRs are not reviewed. If you would like a review, please mark your pull request as ready for review in the GitHub user interface.

Pull requests that are abandoned in draft may be closed due to inactivity.

@riasvdv
riasvdv marked this pull request as ready for review July 29, 2026 08:30
@taylorotwell
taylorotwell merged commit ae89eb5 into laravel:13.x Aug 2, 2026
37 of 53 checks passed
zachiler added a commit to zachiler/framework that referenced this pull request Aug 3, 2026
Image::dimensions(), width() and height() read the size with
getimagesizefromstring(), which misreads HEIC: it returns false for large
grid/tiled HEICs (so those methods throw) and reports the coded/padded frame
size for smaller ones. For HEIC/HEIF, dimensions are now read from the driver,
which decodes the image and reports its true display size, falling back to the
native reader when the driver can't decode the image (e.g. the GD driver).
Every other format is unchanged.

Adds dimensions() to the Image\Driver contract and InterventionDriver, mirroring
dominantColor(). Follow-up to laravel#60922.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
zachiler added a commit to zachiler/framework that referenced this pull request Aug 4, 2026
Image::dimensions(), width() and height() read the size with
getimagesizefromstring(), which misreads HEIC: it returns false for large
grid/tiled HEICs (so those methods throw) and reports the coded/padded frame
size for smaller ones. For HEIC/HEIF, dimensions are now read from the driver,
which decodes the image and reports its true display size, falling back to the
native reader when the driver can't decode the image (e.g. the GD driver).
Every other format is unchanged.

Adds dimensions() to the Image\Driver contract and InterventionDriver, mirroring
dominantColor(). Follow-up to laravel#60922.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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