* Add resize_to_cover
* Add an initial resize_to_cover test
* Fix method name and add passing tests for VIPS
* Add cover method for MiniMagick and add tests
* Rearrange VIPS tests to match source code order
* Update CHANGELOG.md
* Add documentation for cover to both engines
By default, ImageMagick guesses the input file type based on magic
headers and other information. However, it's not always possible for
ImageMagick to correctly identify the file based on its content, and in
some cases it can be a security flaw. So, ImageMagick gives you the
ability to explicitly set the input file type.
convert jpg:input.jpg ...
The vips backend already provides the equivalent :loader option, so we
use the same name for the minimagick counterpart as well.
ImageProcessing::MiniMagick
.source("input.jpg")
.loader(loader: "jpg")
# ...
Sometimes libvips is not able to identify the source image type, even if
there is a corresponding loader. In this case it's useful to be able to
tell libvips which loader to use. So, we add a `:loader` option that
does just that:
ImageProcessing::Vips
.loader(loader: :svg) # calls `Vips::Image.svgload`
# ...
For symmetry, we also add a `:saver` option, just in case libvips isn't
able to correctly identify the file extension of the destination path.
ImageProcessing::Vips
.saver(saver: :tiff) # calls `Vips::Image#tiffsave`
# ...
Closes#49
Vips::Image#remove removes metadata from a Vips::Image, which can be
useful for reducing filesize of an image or stripping potentially
sensitive data.
Like Vips::Image#set, it isn't chainable by default because the method
doesn't return a Vips::Image instance. Like #set, this commit makes
`#remove` chainable as well.
libvips 8.7 added magicksave, which saves the image using ImageMagick,
and ImageMagick can save GIFs. So, as long as libvips 8.7+ is install
and compiled with ImageMagick support, saving GIFs will automatically
work.
This was recommended by the libvips author in
https://github.com/jcupitt/libvips/issues/1095.
Also, since `vips_rotate()` was added to libvips 8.7 as a convenience
alias for `vips_similarity()` and we wouldn't want to break it, we
forward all additional options to `vips_similarity()`, like
`vips_rotate()` probably does.
* Add :mode, :gravity, and :offset parameters for Vips#composite
* Replace :compose and :geometry parameters with :mode and :offset in
MiniMagick#composite
This change makes it possible to position watermarks with the libvips
implementation.
On MiniMagick this wraps the -composite operator along with its
parameters. On libvips this provides a thin wrapper around
Vips::Image#composite.
Closes#35
This is useful because MiniMagick::Tool has a #stack method which
accepts a block, so now you can use it.
ImageProcessing::MiniMagick
.stack { |cmd| ... }
# ...
It's redundant, as you can already use color names as strings. I don't
expect that color names are used nearly as often enough to mandate the
extra convenience of being able to use symbols.
Accepting RGB(A) arrays for color makes the MiniMagick implementation
consistent with the Vips implementation.
Ability to use a Symbol is just a nice-to-have.