You've already forked image_processing
mirror of
https://github.com/usetrmnl/image_processing.git
synced 2026-04-29 13:33:11 -07:00
c108fc752d
This commit adds the chainable API to the MiniMagick module. The old API should still work, but it has been deprecated and will be removed in ImageProcessing 1.0. The new MiniMagick module builds commands directly using MiniMagick::Tool::Convert directly, and avoids the MiniMagick::Image class. This makes it easier to reason about, because it doesn't have the added complexity of the MiniMagick::Image class. The new behaviour is that "-regard-warnings" is now automatically added, which means that a `MiniMagick::Error` will be raised in case of any warnings during processing (such as when image is corrupted). This is most likely what we want. The new `.valid_image?` method is now an order of magnitude faster than the old `#corrupted?` method. For consistency we also add `.valid_image?` to the Vips module as well. The new API doesn't accept arbitrary IO objects anymore, to avoid copying the same file to disk multiple times. The source images need to be File objects now. This also adds some ImageProcessing::Pipeline changes. We extract the logic of creating Tempfiles to it, because MiniMagick module needs it as well. It now also deletes the tempfile in case of any exceptions during processing.
11 lines
269 B
Ruby
11 lines
269 B
Ruby
require "image_processing/chainable"
|
|
require "image_processing/pipeline"
|
|
require "image_processing/version"
|
|
|
|
module ImageProcessing
|
|
Error = Class.new(StandardError)
|
|
|
|
autoload :MiniMagick, 'image_processing/mini_magick'
|
|
autoload :Vips, 'image_processing/vips'
|
|
end
|