libvips使用记录
libvips和ImageMagick都是图像处理库。Rails文档上说libvips比ImageMagick快10倍,内存占用只有ImageMagick的1/10。
安装libvips和libjpeg-turbo-dev
sudo apt install libvips-dev libjpeg-turbo8-dev
去掉Gemfile中image_processing的注释
gem "image_processing", ">= 1.2"
安装ruby-vips
gem "ruby-vips", "~> 2.2"
配置Active Storage使用vips
# config/initializers/active_storage.rb
Rails.application.config.active_storage.variant_processor = :vips