5 Commits

Author SHA1 Message Date
Janko Marohnić 01f856a29e Make the pipeline object accessible to processors
In certain cases processors need to know the source/destination format,
e.g. when they need to perform different operations for different
formats. So we refactor the pipeline class and initialize processors
with it.

With this we also create a separate Builder class, whose sole purpose is
to build options and call the pipeline with those options. This is an
improvement, because previously the Pipeline class was also acting like
a builder by including Chainable. This was making the Pipeline class
difficult to change, as Chainable#method_missing was swallowing any
typos. It was also making it impossible to refactor, because we would
risk the new methods clashing with VIPS/ImageMagick operation names.
2018-03-28 13:13:56 +02:00
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
Janko Marohnić 2d4b9e4d95 Make chainable API generic 2018-03-17 00:49:18 +01:00
GustavoCaso 6e3d0f3665 Autoload Vips 2017-09-24 13:19:42 +02:00
printercu 5c48a04e6a Add lib/image_processing.rb, to make gem bundler-friendly 2017-09-08 14:28:26 +03:00