From ca1296858788780dcb5497e86f66b56170cca279 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Janko=20Marohni=C4=87?= Date: Fri, 6 Apr 2018 01:48:29 +0200 Subject: Use ImageProcessing gem for ActiveStorage variants ImageProcessing gem is a wrapper around MiniMagick and ruby-vips, and implements an interface for common image resizing and processing. This is the canonical image processing gem recommended in [Shrine], and that's where it developed from. The initial implementation was extracted from Refile, which also implements on-the-fly transformations. Some features that ImageProcessing gem adds on top of MiniMagick: * resizing macros - #resize_to_limit - #resize_to_fit - #resize_to_fill - #resize_and_pad * automatic orientation * automatic thumbnail sharpening * avoids the complex and inefficient MiniMagick::Image class * will use "magick" instead of "convert" on ImageMagick 7 However, the biggest feature of the ImageProcessing gem is that it has an alternative implementation that uses libvips. Libvips is an alternative to ImageMagick that can process images very rapidly (we've seen up 10x faster than ImageMagick). What's great is that the ImageProcessing gem provides the same interface for both implementations. The macros are named the same, and the libvips implementation does auto orientation and thumbnail sharpening as well; only the operations/options specific to ImageMagick/libvips differ. The integration provided by this PR should work for both implementations. The plan is to introduce the ImageProcessing backend in Rails 6.0 as the default backend and deprecate the MiniMagick backend, then in Rails 6.1 remove the MiniMagick backend. --- Gemfile.lock | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'Gemfile.lock') diff --git a/Gemfile.lock b/Gemfile.lock index 23b668ac72..c44b772883 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -229,10 +229,10 @@ GEM faye-websocket (0.10.7) eventmachine (>= 0.12.0) websocket-driver (>= 0.5.1) - ffi (1.9.18) - ffi (1.9.18-java) - ffi (1.9.18-x64-mingw32) - ffi (1.9.18-x86-mingw32) + ffi (1.9.23) + ffi (1.9.23-java) + ffi (1.9.23-x64-mingw32) + ffi (1.9.23-x86-mingw32) globalid (0.4.1) activesupport (>= 4.2.0) google-api-client (0.17.3) @@ -265,6 +265,9 @@ GEM httpclient (2.8.3) i18n (1.0.0) concurrent-ruby (~> 1.0) + image_processing (1.2.0) + mini_magick (~> 4.0) + ruby-vips (>= 2.0.10, < 3) io-like (0.3.0) jdbc-mysql (5.1.44) jdbc-postgres (9.4.1206) @@ -393,6 +396,8 @@ GEM ruby-progressbar (~> 1.7) unicode-display_width (~> 1.0, >= 1.0.1) ruby-progressbar (1.9.0) + ruby-vips (2.0.10) + ffi (~> 1.9) ruby_dep (1.5.0) rubyzip (1.2.1) rufus-scheduler (3.4.2) @@ -515,11 +520,11 @@ DEPENDENCIES delayed_job_active_record google-cloud-storage (~> 1.8) hiredis + image_processing (~> 1.2) json (>= 2.0.0) kindlerb (~> 1.2.0) libxml-ruby listen (>= 3.0.5, < 3.2) - mini_magick minitest-bisect mocha mysql2 (>= 0.4.10) -- cgit v1.2.3