```ruby
require 'image_optim'

class ImageOptim
  class Railtie < Rails::Railtie
    initializer 'image_optim.initializer' do |app|
      if app.config.assets.compress && app.config.assets.image_optim != false
        image_optim = ImageOptim.new(app.config.assets.image_optim || {})

        processor = proc do |context, data|
          image_optim.optimize_image_data(data) || data
        end

        app.assets.register_preprocessor 'image/gif', :image_optim, &processor
        app.assets.register_preprocessor 'image/jpeg', :image_optim, &processor
        app.assets.register_preprocessor 'image/png', :image_optim, &processor
      end
    end
  end
end
```

Allow true as a valid value for app.assets.image_optim
user
```ruby
require 'image_optim'

class ImageOptim
  class Railtie < Rails::Railtie
    initializer 'image_optim.initializer' do |app|
      if app.config.assets.compress && app.config.assets.image_optim != false
        image_optim = if app.config.assets.image_optim == true
                        ImageOptim.new
                      else
                        ImageOptim.new(app.config.assets.image_optim || {})
                      end

        processor = proc do |context, data|
          image_optim.optimize_image_data(data) || data
        end

        app.assets.register_preprocessor 'image/gif', :image_optim, &processor
        app.assets.register_preprocessor 'image/jpeg', :image_optim, &processor
        app.assets.register_preprocessor 'image/png', :image_optim, &processor
      end
    end
  end
end
```
assistant