<commit_before># Paperclip::Optimizer

TODO: Write a gem description

## Installation

Add this line to your application's Gemfile:

    gem 'paperclip-optimizer'

And then execute:

    $ bundle

Or install it yourself as:

    $ gem install paperclip-optimizer

## Usage

TODO: Write usage instructions here

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request<commit_msg>Add a basic README<commit_after># PaperclipOptimizer

PaperClipOptimizer is a processor for [Paperclip](https://github.com/thoughtbot/paperclip) that allows 
you to optimize and minify uploaded JPG, PNG or GIF images.

It is just a thin wrapper around [ImageOptim](https://github.com/toy/image_optim), 
which supports many external optimization libraries like

* [advpng](http://advancemame.sourceforge.net/doc-advpng.html) from 
  [AdvanceCOMP](http://advancemame.sourceforge.net/comp-readme.html)
* [gifsicle](http://www.lcdf.org/gifsicle/)
* [jpegoptim](http://www.kokkonen.net/tjko/projects.html)
* jpegtran from [Independent JPEG Group's JPEG library](http://www.ijg.org/)
* [optipng](http://optipng.sourceforge.net/)
* [pngcrush](http://pmt.sourceforge.net/pngcrush/)
* [pngout](http://www.advsys.net/ken/util/pngout.htm)

## Installation

Add this line to your application's Gemfile after the Paperclip gem:

    gem 'paperclip-optimizer'

And then execute:

    $ bundle

See [ImageOptims README](https://github.com/toy/image_optim#binaries-location) 
on how to install the various optimization libraries.

## Usage

Just add ```:paperclip_optimizer``` to Paperclips ```:processors``` - setting:

```ruby
class User < ActiveRecord::Base
  attr_accessible :avatar
  has_attached_file :avatar, 
                    :styles => { :thumb => "100x100>" },
                    :default_url => "/images/:style/missing.png",
                    :processors => [:thumbnail, :paperclip_optimizer]
end
```

Remember to include the ```:thumbnail``` processor as well if you want to retain 
Paperclips geometry functionality.

### Settings

By default, PaperclipOptimizer only enables _jpegtran_ and _optipng_. You can 
pass configuration options to ImageOptim through the ```:styles``` hash:

```ruby
class User < ActiveRecord::Base
  attr_accessible :avatar
  has_attached_file :avatar, 
                    :styles => {
                      :thumb => {
                        :geometry => "100x100>",
                        :paperclip_optimizer => {
                          :pngout => {
                            :strategy => 1
                          }
                        }
                      }
                    },
                    :default_url => "/images/:style/missing.png",
                    :processors => [:thumbnail, :paperclip_optimizer]
end
```

See [ImageOptims options](https://github.com/toy/image_optim#options) for 
all available options.

## Contributing

1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request
{'fraction_non_alphanumeric': 0.11606597434331094, 'fraction_numerical': 0.007025045815516188, 'mean_word_length': 2.8895486935866983, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 17, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1706402', 'n_tokens_mistral': 1026, 'n_tokens_neox': 960, 'n_words': 281}