Installation | image-optimizer-rust | Spatie       

 SPATIE  

image-optimizer-rust
====================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Image-optimizer-rust](https://spatie.be/docs/image-optimizer-rust/v1)  Installation

 Version   v1      

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

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

 Installation
============

###  On this page 

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

You can install the package from GitHub. Add this dependency to your `Cargo.toml`:

```
[dependencies]
spatie-image-optimizer = { git = "https://github.com/spatie/image-optimizer-rust", branch = "main" }
```

Requires Rust 1.89 or newer. The crate is not yet published to crates.io. Commit your application's `Cargo.lock` to keep the selected Git revision between builds.

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

The package uses these optimizers for matching image formats:

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

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

```
sudo apt-get install jpegoptim optipng pngquant gifsicle webp libavif-bin
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
```

On Fedora:

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

Install only the formats you need. AVIF needs both `avifdec` and `avifenc` (libavif 0.9.3 or newer with the documented options). On Windows install native executables and add them to `PATH`, or use `set_binary_path`. Node is required only for the external SVGO tool, not for the Rust library.

 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)
