Installation and setup | 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)  Installation and setup

 Version   v1      

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

  Installation and setup    
- [ 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)

 Installation and setup
======================

###  On this page 

1. [ Optimization tools ](#content-optimization-tools)

You can install the package using Go 1.27 or newer:

```
go get github.com/spatie/image-optimizer-go@v0.1.0
```

Optimization tools
--------------------------------------------------------------------------------------------------------------

The package uses these optimizers when present on your system:

- [Jpegoptim](https://github.com/tjko/jpegoptim)
- [Optipng](https://optipng.sourceforge.net/)
- [Pngquant 2](https://pngquant.org/)
- [SVGO](https://github.com/svg/svgo)
- [Gifsicle](https://www.lcdf.org/gifsicle/)
- [cwebp](https://developers.google.com/speed/webp/docs/precompiled)
- [avifenc and avifdec](https://github.com/AOMediaCodec/libavif)

Here's how to install all the optimizers on Ubuntu/Debian:

```
sudo apt-get install jpegoptim optipng pngquant gifsicle webp libavif-bin
sudo npm install -g svgo@3
```

And here's how to install the binaries on macOS using [Homebrew](https://brew.sh/):

```
brew install jpegoptim optipng pngquant gifsicle webp libavif
npm install -g svgo@3
```

And here's how to install the binaries on Fedora/RHEL/CentOS:

```
sudo dnf install epel-release
sudo dnf install jpegoptim optipng pngquant gifsicle libwebp-tools libavif-tools
sudo npm install -g svgo@3
```

AVIF needs libavif 0.9.3 or newer with the AOM encoder for the default `-a` arguments. The tested versions are listed on [example conversions](example-conversions). Tool versions can change output and supported arguments. SVGO uses the installed configuration, not a built-in plugin override.

On Windows, install compatible native builds and add their directories to `PATH`, or configure each `BinaryOptimizer.BinaryPath`. Go API tests run on Linux, macOS and Windows. Native-tool integration runs on Linux.

 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)
