Image processing for Ruby on Rails & ActiveStorage
Speed up Rails image uploads with our official gem. It works alongside ActiveStorage variants and Sidekiq background jobs.
Install
$ gem install smallpict-rubyImplementation example
# Gemfile
gem 'smallpict-ruby'
# config/initializers/smallpict.rb
SmallPict.configure do |config|
config.api_key = ENV['SMALLPICT_API_KEY']
config.auto_format = :auto # Selects AVIF or WebP based on client
config.quality = 82
end
# In your Controller / Service:
optimized_url = SmallPict.optimize(
user.avatar.url,
width: 400,
format: :avif
)Integration steps
Add gem to Gemfile
Add gem 'smallpict' to your Gemfile and run bundle install.
Configure initializer
Create config/initializers/smallpict.rb with your API key and default format.
Process attachments
Use smallpict_optimize on ActiveStorage attachments before persisting to cloud.
Key benefits
- Works with ActiveStorage
- Sidekiq and GoodJob background worker adapters
- Automatic fallback handling during network blips
- Preserves original master files alongside modern formats
Need complete implementation guides & API specs?
Explore parameter references, authentication mechanisms, error codes, and local testing instructions in our official Ruby & Rails gem developer guide.
Read Ruby & Rails gem DocsSpeed Up Your Ruby & Rails gem Image Pipeline
Try AVIF and WebP image optimization in your application. No setup fee, and sandbox keys right away.