Example conversions | image-optimizer-go | Spatie       

 SPATIE  

image-optimizer-go
==================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Image-optimizer-go](https://spatie.be/docs/image-optimizer-go/v1)  Example conversions

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/image-optimizer-go/v1) 

  Example conversions    
- [ Introduction ](https://spatie.be/docs/image-optimizer-go/v1/introduction)
- [ Installation and setup ](https://spatie.be/docs/image-optimizer-go/v1/installation-and-setup)
- [ Usage ](https://spatie.be/docs/image-optimizer-go/v1/usage)
- [ Which tools will do what? ](https://spatie.be/docs/image-optimizer-go/v1/which-tools-will-do-what)
- [ Logging the optimization process ](https://spatie.be/docs/image-optimizer-go/v1/logging-the-optimization-process)
- [ Example conversions ](https://spatie.be/docs/image-optimizer-go/v1/example-conversions)
- [ Testing ](https://spatie.be/docs/image-optimizer-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/image-optimizer-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/image-optimizer-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/image-optimizer-go/v1/support-us)

 Example conversions
===================

###  On this page 

1. [ jpg ](#content-jpg)
2. [ webp ](#content-webp)
3. [ avif ](#content-avif)
4. [ png ](#content-png)
5. [ svg ](#content-svg)
6. [ gif ](#content-gif)

Here are some real life example conversions done by this package.

Methodology for JPG, WEBP, AVIF images: the [original image](https://unsplash.com/photos/jTeQavJjBDs) has been fed to [spatie/image](https://github.com/spatie/image) (using the default GD driver) and resized to 2048px width.

These are the existing [PHP fixtures](https://github.com/spatie/image-optimizer#example-conversions), optimized with the Go package's default chain without resizing again, including the animated GIF from the PHP test suite.

FormatOriginal bytesOptimized bytesReductionJPG789,989523,42233.74%WebP472,102414,03612.30%AVIF742,683197,71273.38%PNG40,3029,76475.77%SVG25,58619,16425.10%GIF652,193609,9776.47%Sizes are measured in bytes, not rounded kilobytes. These results were measured on Linux on December 2, 2026, with jpegoptim 1.4.7, pngquant 2.18.0, OptiPNG 0.7.8, SVGO 3.3.5, Gifsicle 1.96, cwebp 1.5.0 and libavif 1.2.1. Results will vary with tool versions and image content. A smaller file does not imply identical pixels. JPEG, PNG, WebP and AVIF optimization can be lossy. No DSSIM score was measured.

jpg
-----------------------------------------------------------------

Original, 789,989 bytes:

![Original JPG photo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/original-image.jpg)

Optimized, 523,422 bytes (33.74% smaller):

![Optimized JPG photo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/image.jpg)

webp
--------------------------------------------------------------------

Original, 472,102 bytes:

![Original WebP photo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/original-image.webp)

Optimized, 414,036 bytes (12.30% smaller):

![Optimized WebP photo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/image.webp)

avif
--------------------------------------------------------------------

Original, 742,683 bytes:

![Original AVIF photo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/original-image.avif)

Optimized, 197,712 bytes (73.38% smaller):

![Optimized AVIF photo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/image.avif)

Photo credit: Jeff Sheldon, via [Unsplash](https://unsplash.com).

png
-----------------------------------------------------------------

Original: Photoshop 'Save for web' | PNG-24 with transparency
40,302 bytes

![Original PNG logo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/original-logo.png)

Optimized, 9,764 bytes (75.77% smaller):

![Optimized PNG logo](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/logo.png)

svg
-----------------------------------------------------------------

Original: Illustrator | Web optimized SVG export
25,586 bytes

![Original SVG graph](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/original-graph.svg)

Optimized, 19,164 bytes (25.10% smaller):

![Optimized SVG graph](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/graph.svg)

gif
-----------------------------------------------------------------

Original, 652,193 bytes:

![Original animated GIF](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/original-animated.gif)

Optimized, 609,977 bytes (6.47% smaller):

![Optimized animated GIF](https://fls-a2e2b4d6-b344-41b9-abd1-6c06196a36b3.laravel.cloud/docs/image-optimizer-go/v1/examples/animated.gif)

To try these conversions yourself, use the [default chain](usage) with the images in `testdata`. Use `OptimizeTo` to keep the source images untouched. The [native tests](testing) run every format and check the output.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
