Hello everyone, ActiveStorage performs image processing on-the-fly, and for that it currently uses raw MiniMagick. As we can see from CarrierWave <https://github.com/carrierwaveuploader/carrierwave/blob/master/lib/carrierwave/processing/mini_magick.rb> and Refile <https://github.com/refile/refile-mini_magick>, for common image resizing it's not enough to just use simple ImageMagick options, certain resizers like "resize_to_fill" require a combination of ImageMagick options to achieve the desired effect.
To avoid reimplementing this functionality, I propose that ActiveStorage uses the *ImageProcessing* <https://github.com/janko-m/image_processing> gem, as a layer on top of MiniMagick. The ImageProcessing gem has been developing for almost 3 years now, and it's gotten pretty good. It was primarily written to be used with Shrine <https://github.com/shrinerb/shrine>, but I deliberately made it generic so that other file attachment libraries can use it as well and avoid reimplementing the same functionality. Some features that are added on top of MiniMagick: - resizing macros: - #resize_to_limit <https://github.com/janko-m/image_processing/blob/master/doc/minimagick.md#resize_to_limit> - #resize_to_fit <https://github.com/janko-m/image_processing/blob/master/doc/minimagick.md#resize_to_fit> - #resize_to_fill <https://github.com/janko-m/image_processing/blob/master/doc/minimagick.md#resize_to_fill> - #resize_and_pad <https://github.com/janko-m/image_processing/blob/master/doc/minimagick.md#resize_and_pad> - automatic orientation <https://www.imagemagick.org/script/command-line-options.php#auto-orient> - automatic thumbnail sharpening <https://github.com/janko-m/image_processing/blob/master/doc/minimagick.md#sharpening> - avoids the complex MiniMagick::Image class But probably the biggest features of the ImageProcessing gem is that it also ships with the *libvips* <http://jcupitt.github.io/libvips/> backend. Libvips is an alternative to ImageMagick. The advantage of using libvips is that in most cases it's* multiple times faster than ImageMagick*. This is a big deal. The ImageProcessing gem provides a uniform API regardless of which backend is used, just the operations/options specific to ImageMagick and libvips differ of course. That means the potential ActiveStorage integration would work for both ImageMagick and libvips, allowing the user to swap backends with just a single line of code. So, my question is: would you be open to accepting a pull request that replaces MiniMagick with ImageProcessing? Kind regards, Janko -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Core" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-core+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-core@googlegroups.com. Visit this group at https://groups.google.com/group/rubyonrails-core. For more options, visit https://groups.google.com/d/optout.