Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Image Laravel Package

spatie/image

spatie/image provides an expressive, chainable PHP API for common image manipulation. Resize to fit a bounding box without altering aspect ratio, apply greyscale, adjust brightness and quality, rotate, sharpen, and save or overwrite images in just a few lines. Ideal for Laravel and PHP apps.

View on GitHub
Deep Wiki
Context7

spatie/image is a PHP package that makes image manipulation simple through an expressive, chainable API. Built on top of Intervention Image, it lets you load an image, apply transformations, and save it in just a few lines—no complex configuration required.

  • Chainable operations: resize, crop, rotate, greyscale, brightness, sharpen, and more
  • Format & quality control: convert between JPEG, PNG, WebP, and AVIF with adjustable compression
  • Aspect-ratio aware resizing: fit images into exact dimensions without distortion
  • Optimization built in: automatically reduce file sizes while preserving visual quality
  • Framework friendly: works standalone or seamlessly within Laravel applications

Perfect for generating thumbnails, preparing user uploads, or batch-processing media.

Frequently asked questions about Image
How do I install spatie/image in a Laravel app?
Install it with Composer using composer require spatie/image. You need PHP 8.1 or newer and at least one supported image extension, such as GD, Imagick, or Vips; GD is the default fallback. No external service is required, and in Laravel you can use Spatie\Image\Image directly in controllers, jobs, observers, or alongside the Storage facade.
Which image driver should I use with spatie/image: GD, Imagick, or Vips?
Spatie Image abstracts GD, Imagick, and Vips behind one API, so the same chain works across drivers. GD is the lightweight default fallback, Imagick is often preferred for advanced features and production workloads, and Vips can be faster for heavy processing. Format support and performance depend on the installed PHP extension and its delegates, so test on your host.
Does spatie/image work with Laravel 10, 11, and 12?
Spatie Image is a framework-agnostic PHP package, so it can be used in Laravel 10, 11, and 12 as long as the application meets its PHP 8.1+ and image-extension requirements. It does not depend on a specific Laravel major version for its core manipulation API. Check the package Composer constraints and release notes for exact compatibility with your Laravel and PHP versions.
How do I resize, crop, and save images with spatie/image's fluent API?
Load an image with Image::load($path), chain operations such as width(100)->height(100), fit(200, 200), crop(), greyscale(), brightness(), quality(), or sharpen(), then call save($newPath). For example, Image::load($path)->width(100)->height(100)->save($newPath) fits the image into a 100x100 box without changing aspect ratio. The fluent API keeps pipelines readable and composable inside Laravel services, observers, or jobs.
Can spatie/image resize images in the background using Laravel queues?
Spatie Image has no built-in queue support, so async processing is handled by Laravel queue system. Put the Image::load()->resize()->save() chain inside a job and dispatch it from your controller or observer. For large batches, use multiple queue workers or chunked jobs because the package itself does not provide native parallelism.
How do I use spatie/image with Laravel Storage or S3?
The package focuses on local filesystem paths, so local disks work well with Storage::disk('public')->path($file) or storage_path(). For S3 or other cloud disks, download or stream the object to a temporary local file, process it with Spatie Image, then upload the result back through the Storage facade. There is no native CDN or cloud-storage optimization, so your app must handle temp files and cleanup.
Does spatie/image support WebP and AVIF images?
WebP and AVIF support is driver-dependent, not guaranteed by the package itself; it depends on the underlying GD, Imagick, or Vips build and its delegates. For AVIF, GD must be compiled with libavif support and Imagick needs a libheif delegate, so verify with gd_info() or Imagick::queryFormats('AVIF') on each environment. Since 3.9.7, palette or indexed source images are converted to truecolor before GD AVIF encoding to avoid corrupt output.
How should I test image manipulation code that uses spatie/image?
Use small fixture images and write processed output to temporary files, then assert dimensions, MIME type, or file existence rather than comparing raw binary data. In Laravel tests, you can fake Storage for uploads and still process a local fixture path with Spatie Image. Because results can vary by driver, run the relevant checks against the same GD, Imagick, or Vips configuration used in CI or production.
What production concerns should I watch for when using spatie/image?
Check driver availability and format support on the production host, especially for WebP and AVIF, because support is determined by the PHP extension build. Watch memory and CPU use for large images or batch jobs, and offload heavy work to Laravel queue workers. The package is lightweight and has no external services, but cloud storage flows need temporary files and cleanup, and the package does not provide native parallelism.
How does spatie/image compare to Intervention Image, and is it still maintained?
Spatie Image is known for its expressive fluent API and driver abstraction across GD, Imagick, and Vips, while Intervention Image is another popular Laravel-friendly option with its own driver model. Spatie Image is an actively maintained MIT-licensed Spatie package with automated tests, but you should still review release notes for driver-specific fixes such as the AVIF palette handling in 3.9.7. Choose based on the API style, driver requirements, and format support your application needs.
Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
alesima/laravel-azure-service-bus
tomshaw/shopcart
likyly/laravel
darthsoup/shoppingcart
tdt/core
labyrinthe/connect-php
encore2/laravel-admin2
cboxdk/laravel-console-kit
shapecode/doctrine-dbal-datetimeutc
gilads-otiannoh254/inertia-protocol
dakiquang/laravel-oauth-refresh-lock
woda/laravel-worktrees
dalefranks/ramasite
faghy/laracashbook
roundly-consulting/google-places-for-laravel
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel