Files
image_processing/lib/image_processing.rb
T
Janko Marohnić c108fc752d Rewrite MiniMagick module to use the chainable API
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.
2018-03-20 13:41:47 +01:00

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