ExOptimizer is a tool to optimize pictures by running them through a chain of various image optimization tools. It's heavily inspired by the tool ImageOptimizer for PHP.
Here's how you can use it:
ExOptimizer.optimize(path_to_image)
The image at path_to_image
will be overwritten by an optimized version which should be smaller. The package will automatically detect which optimization binaries are installed on your system and use them.
You can install the package through Hex.pm by adding ex_optimizer
to your list of dependencies in mix.exs
:
def deps do
[
{:ex_optimizer, "~> 0.1.0"}
]
end
Then running mix deps.get
to fetch the package.
https://hexdocs.pm/ex_optimizer.
The package will use these optimizers if they are present on your system:
Here's how to install all the optimizers on Ubuntu:
sudo apt-get install jpegoptim
sudo apt-get install optipng
sudo apt-get install pngquant
sudo npm install -g svgo
sudo apt-get install gifsicle
sudo apt-get install webp
And here's how to install the binaries on MacOS (using Homebrew):
brew install jpegoptim
brew install optipng
brew install pngquant
brew install svgo
brew install gifsicle
brew install webp
Please see CHANGELOG for more information what has changed recently.
mix test
You can see coverage with
mix coveralls.html
Framasoft is a French not-for-profit popular educational organisation that lives only through your donations. It provides free online services part of the De-google-ify Internet campaign and leads projects like PeerTube and Mobilizon.