Laravel Image Processing with Illuminate\\Image | Mohamed Said        [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com) [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles  ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

       [  ](https://github.com/EG-Mohamed)       

 [ Home ](https://msaied.com) [ Projects ](https://msaied.com/projects) [ Articles ](https://msaied.com/articles) [ Certificates ](https://msaied.com/certificates) [ Contact ](https://msaied.com#contact-section) 

  [ home ](https://msaied.com)    [ articles ](https://msaied.com/articles)    Laravel's First-Party Image Processing: A Practical Guide to Illuminate\\Image        On this page       1. [  Laravel 13.20 Introduces First-Party Image Processing ](#laravel-1320-introduces-first-party-image-processing)
2. [  Setup ](#setup)
3. [  Creating an Image Instance ](#creating-an-image-instance)
4. [  How the Pipeline Works ](#how-the-pipeline-works)
5. [  Resizing Methods ](#resizing-methods)
6. [  Formats, Quality, and optimize() ](#formats-quality-and-optimize)
7. [  Storing Results ](#storing-results)
8. [  Practical Example: Avatar Upload Controller ](#practical-example-avatar-upload-controller)
9. [  Conditional Transformations ](#conditional-transformations)
10. [  Key Takeaways ](#key-takeaways)

  ![Laravel's First-Party Image Processing: A Practical Guide to Illuminate\Image](https://cdn.msaied.com/460/5cb923ccb4db6434fec59637652666f0.png)

 [  Laravel ](https://msaied.com/articles?category=laravel)  #Laravel   #Image Processing   #Illuminate\\Image   #WebP   #Intervention Image  

 Laravel's First-Party Image Processing: A Practical Guide to Illuminate\\Image 
================================================================================

     23 Jul 2026      3 min read    ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said  

       Table of contents

  10 sections  

1. [  01   Laravel 13.20 Introduces First-Party Image Processing  ](#laravel-1320-introduces-first-party-image-processing)
2. [  02   Setup  ](#setup)
3. [  03   Creating an Image Instance  ](#creating-an-image-instance)
4. [  04   How the Pipeline Works  ](#how-the-pipeline-works)
5. [  05   Resizing Methods  ](#resizing-methods)
6. [  06   Formats, Quality, and optimize()  ](#formats-quality-and-optimize)
7. [  07   Storing Results  ](#storing-results)
8. [  08   Practical Example: Avatar Upload Controller  ](#practical-example-avatar-upload-controller)
9. [  09   Conditional Transformations  ](#conditional-transformations)
10. [  10   Key Takeaways  ](#key-takeaways)

       Laravel 13.20 Introduces First-Party Image Processing
-----------------------------------------------------

Laravel 13.20 added native image processing through the new `Illuminate\Image` component ([PR #59276](https://github.com/laravel/framework/pull/59276)). Before this release, every resize or WebP conversion required wiring up a third-party package manually. Now the framework ships a fluent, immutable API that handles resizing, cropping, format conversion, quality control, effects, and storing results on any filesystem disk.

Setup
-----

The GD and Imagick drivers are backed by [Intervention Image](https://github.com/Intervention/image) v4, which is a *suggested* dependency. Install it with:

```bash
composer require intervention/image:^4.0

```

Laravel defaults to the GD driver. Switch to Imagick per-image or globally via the `images.default` config:

```php
$image->usingImagick()->toBytes();

```

Creating an Image Instance
--------------------------

The new `Request::image()` method is the most convenient entry point for uploads:

```php
$image = $request->image('avatar'); // ?Illuminate\Image\Image

```

For every other source, use the `Image` facade or `Storage`:

```php
$image = Image::fromPath('/path/to/photo.jpg');
$image = Image::fromUrl('https://example.com/photo.jpg');
$image = Image::fromStorage('uploads/photo.jpg', 's3');
$image = Storage::disk('s3')->image('uploads/photo.jpg');

```

How the Pipeline Works
----------------------

Every transformation returns a **new** `Image` instance and nothing is processed until you request output (`store()`, `toBytes()`, `width()`, etc.). This lets you branch a single base image into multiple variants without side effects:

```php
$photo = Image::fromStorage('uploads/photo.jpg')->orient();

$thumbnail = $photo->cover(300, 300)->quality(60)->toWebp();
$display   = $photo->scale(width: 1600)->quality(80)->toWebp();

$thumbnail->storeAs('photos', 'photo-thumb.webp', disk: 's3');
$display->storeAs('photos', 'photo-display.webp', disk: 's3');

```

Calling `orient()` first auto-rotates the image using EXIF data—essential for phone camera uploads.

Resizing Methods
----------------

| Method | Behaviour | |---|---| | `cover($w, $h)` | Resize and crop to exact dimensions | | `contain($w, $h, $bg)` | Fit inside dimensions, pad with background | | `scale($w, $h)` | Proportional resize, never upscales | | `resize($w, $h)` | Force exact dimensions, may distort | | `crop($w, $h, $x, $y)` | Cut a region at the given offset |

Formats, Quality, and optimize()
--------------------------------

Convert to any common format with dedicated methods:

```php
$image->toWebp()->quality(80);
$image->toAvif()->quality(70);
$image->toPng();

```

The `optimize()` shortcut converts to WebP at quality 70 by default:

```php
$image->optimize();           // WebP @ 70
$image->optimize('avif', 60); // AVIF @ 60

```

Storing Results
---------------

```php
$path = $image->store('avatars');                     // hashed filename
$path = $image->storeAs('avatars', 'user-1.webp');    // explicit name
$path = $image->storePublicly('avatars', disk: 's3'); // public visibility

```

The hashed filename automatically uses the correct extension for the output format.

Practical Example: Avatar Upload Controller
-------------------------------------------

```php
public function update(Request $request)
{
    $request->validate(['avatar' => ['required', 'image', 'max:5120']]);

    $path = $request->image('avatar')
        ->orient()
        ->cover(512, 512)
        ->optimize()
        ->storePublicly('avatars', disk: 's3');

    $request->user()->update(['avatar_path' => $path]);

    return back();
}

```

Conditional Transformations
---------------------------

`Image` uses Laravel's `Conditionable` trait, so `when()` works as expected:

```php
$image = $request->image('photo')
    ->when($request->boolean('grayscale'), fn ($img) => $img->grayscale())
    ->scale(width: 1200)
    ->optimize();

```

Key Takeaways
-------------

- **No extra wiring**: `Illuminate\Image` is built into Laravel 13.20; just install Intervention Image v4.
- **Immutable pipeline**: transformations return new instances, making multi-variant generation safe and clean.
- **`scale()` never upscales**: safe default for responsive image generation.
- **`optimize()`** is a one-call shortcut to WebP at quality 70.
- **Images cannot be serialized** to queued jobs—store first, pass the path.
- **`ImageException`** is the single exception type for all processing failures.

---

*Source: [A Practical Guide to Laravel's First-Party Image Processing](https://laravel-news.com/a-practical-guide-to-laravels-first-party-image-processing) — Laravel News*

 Found this useful?

          [  ](https://twitter.com/intent/tweet?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravels-first-party-image-processing-a-practical-guide-to-illuminateimage&text=Laravel%27s+First-Party+Image+Processing%3A+A+Practical+Guide+to+Illuminate%5CImage) [  ](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fmsaied.com%2Farticles%2Flaravels-first-party-image-processing-a-practical-guide-to-illuminateimage) 

 Frequently Asked Questions 
----------------------------

  3 questions  

     Q01  Do I need to install a separate package to use Laravel's image processing in 13.20?        Yes, one package is required. The `Illuminate\Image` component is built into Laravel 13.20, but it relies on Intervention Image v4 as a suggested dependency. Run `composer require intervention/image:^4.0` to enable the GD or Imagick driver. 

      Q02  Can I send an Image instance to a Laravel queued job?        No. Attempting to serialize an `Image` instance for a queued job throws an `ImageException`. The recommended pattern is to store the image first and pass the resulting file path to the job instead. 

      Q03  What is the difference between scale() and resize() in Illuminate\\Image?        `scale()` resizes proportionally and never upscales the image—it maps to Intervention's `scaleDown()` internally. `resize()` forces exact dimensions and may distort the image if the aspect ratio differs. 

  Continue reading

 More Articles 
---------------

 [ View all    ](https://msaied.com/articles) 

 [ ![Laravel Founders Summit 2026: A One-Day Gathering for Laravel Business Leaders](https://cdn.msaied.com/461/12537bd0a10d8e3a3a6aea18a1e8a8d5.png) Laravel Founders Summit Laravel Events 

### Laravel Founders Summit 2026: A One-Day Gathering for Laravel Business Leaders

Laravel has opened applications for the Founders Summit, a one-day invite-only event in November 2026 for foun...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 23 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/laravel-founders-summit-2026-a-one-day-gathering-for-laravel-business-leaders) [ ![6 Laravel UI Kits and Component Libraries for 2025 (Tailwind v4 + Livewire)](https://cdn.msaied.com/457/dba84fd2829714df4374ab87d7378b51.png) Laravel Tailwind CSS Livewire 

### 6 Laravel UI Kits and Component Libraries for 2025 (Tailwind v4 + Livewire)

A hands-on comparison of six Laravel Blade UI component libraries—Flowbite, daisyUI, Preline, maryUI, Sheaf UI...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 22 Jul 2026     4 min read  

  Read    

 ](https://msaied.com/articles/6-laravel-ui-kits-and-component-libraries-for-2025-tailwind-v4-livewire) [ ![Filament v5.7.2 Released: Bug Fixes for Forms, Tables, and Accessibility](https://cdn.msaied.com/458/6b5ec072e1abf9a9041a2fd33d94614e.png) Filament Laravel PHP 

### Filament v5.7.2 Released: Bug Fixes for Forms, Tables, and Accessibility

Filament v5.7.2 ships 19 bug fixes covering Toggle helper text visibility, Builder/Repeater item caching, Morp...

  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MJ.jpg)  Mohamed Said 

 22 Jul 2026     3 min read  

  Read    

 ](https://msaied.com/articles/filament-v572-released-bug-fixes-for-forms-tables-and-accessibility) 

   [  ![Mohamed Said](https://cdn.msaied.com/01KT78WE565VEMM3PSNQAAB0MH.png)   Mohamed Said Laravel Backend Engineer  ](https://msaied.com)Senior Backend Engineer specializing in Laravel, scalable SaaS platforms, APIs, and cloud infrastructure. I build secure, high-performance web applications that help businesses grow.

Explore

- [Home](https://msaied.com)
- [Projects](https://msaied.com/projects)
- [Articles](https://msaied.com/articles)
- [Certificates](https://msaied.com/certificates)
- [Contact](https://msaied.com#contact-section)

Connect

- [   hello@msaied.com ](mailto:hello@msaied.com)
- [   +20 109 461 9204 ](tel:+201094619204)

© 2026 Mohamed Said. All rights reserved.

 [  ](https://github.com/EG-Mohamed) [  ](https://www.linkedin.com/in/msaiedm/) [  ](https://wa.me/201094619204) [  ](mailto:hello@msaied.com) [  ](https://drive.google.com/file/u/0/d/1MF20IPRJyzfy32mhEutjL5EpSls0w2Q8/view)
