65 Commits
Author SHA1 Message Date
Janko Marohnić 9d72e46bce Support resize-on-load for resize to cover
We can now rename it back to `#resize_to_cover`, since vips backend
requires all `resize_to_*` operations to support resize-on-load.
2024-06-15 23:10:03 +02:00
Janko Marohnić c2a9a73044 Remove non-existing #append Vips API
Closes #122
2024-06-10 14:53:27 +02:00
Brendon Muir 8c85ad9252 Add resize_to_cover (#120)
* 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
2024-06-06 12:02:29 +02:00
Paul Filipow 52d5126fde fix typo in documentation (#85) 2021-04-12 23:28:26 +02:00
Janko Marohnić 20b92de6e1 Update changelog and docs for turned off sharpening 2020-05-17 10:01:01 +02:00
Janko Marohnić 7cd4058e14 [minimagick] Add #crop with left, top, width, height arguments
This allows us to replace

  crop("300x300+0+50")

with

  crop(0, 50, 300, 300)

This matches the existing libvips' vips_crop() arguments.
2020-05-17 09:30:25 +02:00
Janko Marohnić 8b48f2e919 [minimagick] Add :loader for explicitly setting input file type
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")
    # ...
2019-12-18 16:54:03 +01:00
Janko Marohnić 979ec7826d Remove -regard-warnings from examples
This option does not in fact get added. I don't know where that came
from.
2019-12-18 16:52:57 +01:00
Janko Marohnić 9fb6a0b9ee Add table of contents 2019-12-10 13:49:50 +01:00
Janko Marohnić 4927d40c83 [vips] Allow forcing a specific loader or saver
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
2019-04-09 01:07:31 +02:00
Janko Marohnić 4880c27bff [vips] Simplify resize-on-load logic a bit 2019-02-25 11:04:06 +01:00
Janko Marohnić 3c9c0922b8 [vips] Perform resize-on-load when possible
Resizing on load using `vips_thumbnail()` (versus after load using
`vips_thumbnail_image()`) can speed up resizing significantly, and in
some cases even make it more accurate.

  thumbnail_image() (1000px => 300px) – 0.062s
  thumbnail()       (1000px => 300px) – 0.031s

  thumbnail_image() (1000px => 500px) – 0.045s
  thumbnail()       (1000px => 500px) – 0.043s

  thumbnail_image() (1000px => 800px) – 0.046s
  thumbnail()       (1000px => 800px) – 0.043s

  thumbnail_image() (1500px => 300px) – 0.104s
  thumbnail()       (1500px => 300px) – 0.037s

  thumbnail_image() (1500px => 500px) – 0.096s
  thumbnail()       (1500px => 500px) – 0.068s

  thumbnail_image() (1500px => 800px) – 0.090s
  thumbnail()       (1500px => 800px) – 0.066s

  thumbnail_image() (2000px => 300px) – 0.154s
  thumbnail()       (2000px => 300px) – 0.041s

  thumbnail_image() (2000px => 500px) – 0.170s
  thumbnail()       (2000px => 500px) – 0.051s

  thumbnail_image() (2000px => 800px) – 0.147s
  thumbnail()       (2000px => 800px) – 0.093s

  thumbnail_image() (2500px => 300px) – 0.219s
  thumbnail()       (2500px => 300px) – 0.046s

  thumbnail_image() (2500px => 500px) – 0.218s
  thumbnail()       (2500px => 500px) – 0.053s

  thumbnail_image() (2500px => 800px) – 0.215s
  thumbnail()       (2500px => 800px) – 0.123s

  thumbnail_image() (3000px => 300px) – 0.300s
  thumbnail()       (3000px => 300px) – 0.046s

  thumbnail_image() (3000px => 500px) – 0.310s
  thumbnail()       (3000px => 500px) – 0.076s

  thumbnail_image() (3000px => 800px) – 0.302s
  thumbnail()       (3000px => 800px) – 0.146s

Closes #48
2019-02-25 10:45:47 +01:00
Janko Marohnić 2e55d7bb4c [vips] Add link to emulating :low & :high crop behaviour 2019-02-11 20:50:06 +01:00
Thomas Menelle 71bb90aabc list libvips 8.8 thumbnail new crop options inside vips readme 2019-02-10 16:17:51 +01:00
Janko Marohnić 48bc840247 Update libvips GH links to point to the new org 2018-09-27 01:12:55 +02:00
Janko Marohnić 41c3198c6d Update libvips links with the new location 2018-09-27 01:11:44 +02:00
Janko Marohnić fcdc623791 [vips] Make #remove chainable
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.
2018-09-27 01:08:59 +02:00
Janko Marohnić 9c49461621 Add note that libvips 8.7+ supports saving GIFs
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.
2018-09-20 03:59:41 +02:00
Janko Marohnić b8ef94fd03 [vips] Make #rotate always call vips_similarity()
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.
2018-09-20 03:21:07 +02:00
Janko Marohnić eb26b8b9c7 Use same :mode and :gravity parameters 2018-07-13 14:08:10 +02:00
Janko Marohnić f24c6d683e [minimagick, vips] Normalize #composite interface
* 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.
2018-07-13 13:57:52 +02:00
Janko Marohnić e15b47dd43 [minimagick, vips] Add #composite method
On MiniMagick this wraps the -composite operator along with its
parameters. On libvips this provides a thin wrapper around
Vips::Image#composite.

Closes #35
2018-07-10 01:07:52 +02:00
Janko Marohnić 390ee1b6ad [minimagick, vips] Allow operations to accept blocks
This is useful because MiniMagick::Tool has a #stack method which
accepts a block, so now you can use it.

  ImageProcessing::MiniMagick
    .stack { |cmd| ... }
    # ...
2018-07-06 15:29:14 +02:00
Janko Marohnić d26717b8fa [minimagick] Remove support for symbol color names
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.
2018-06-16 00:10:56 +02:00
Janko Marohnić d50d39a19d [minimagick] Accept RGB(A) arrays and symbols for color names for :background
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.
2018-06-14 21:45:33 +02:00