No commit activity in last 3 years
No release in over 3 years
Nanoc image compressor filter
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

>= 0
>= 0
>= 0

Runtime

>= 3.3.1
 Project Readme

Nanoc Image Compressor

Build Status

A nanoc filter that compresses gif, jpg and png images losslessly.

Installation

1. Install the gem

Add this line to your site's Gemfile:

gem 'nanoc-image-compressor'

And then execute:

$ bundle

Or install it yourself as:

$ gem install nanoc-image-compressor

2. Install the binaries

This gem uses the image_optim gem which depends on binaries being installed (advpng, gifsicle, jpegoptim, jpegtran, optipng, pngcrush, pngout). See the image_optim README for instructions on how to install these binaries.

3. Add a require statement

Add this line to your site's lib/default.rb:

require 'nanoc/filters/image_compressor'

Usage

Add a filter within a compile block in your site's Rules:

compile '/images/*/' do
  filter :image_compressor if item.binary?
end

Any options will be passed to image_optim:

compile '/images/*/' do
  if item.binary?
    # we don't have pngout on our system
    filter :image_compressor, :pngout => false
  end
end