Skip to content
Permalink
Browse files

Require libvips 8.6+

Some functions that image_processing/vips is using, such as
`vips_thumbnail_image()` and `vips_gravity()`, were added in 8.6.0, so
we explicitly fail if libvips 8.6+ is not installed.
  • Loading branch information...
janko committed Mar 14, 2018
1 parent 00093f9 commit 68565cc167af92ed293c58eceaafce8f96f9a881
Showing with 2 additions and 0 deletions.
  1. +2 −0 lib/image_processing/vips.rb
@@ -6,6 +6,8 @@

require "tempfile"

fail "image_processing/vips requires libvips 8.6+" unless Vips.at_least_libvips?(8, 6)

module ImageProcessing
module Vips
module_function

7 comments on commit 68565cc

@renchap

This comment has been minimized.

Copy link

renchap replied Apr 13, 2018

libvips 8.6 is not packaged in many distributions yet (latest Debian and Ubuntu have 8.4 for example).
This makes it hard to use vips in production or CI as you need to build a recent version (and cache it for CI, create packages for production, ...).
Would it be hard to have a requirement on 8.4+ (Debian, Ubuntu) or 8.2+ (Ubuntu LTS), and use an alternative implementation of the missing functions if at a lower version (or all the time)?

I know it is a bit more work but I see this as really blocking for any deployment until libvips 8.6 is available in (not outdated) distros.

Ping @janko-m

@janko

This comment has been minimized.

Copy link
Owner Author

janko replied Apr 15, 2018

libvips 8.6 is not packaged in many distributions yet (latest Debian and Ubuntu have 8.4 for example).
This makes it hard to use vips in production or CI as you need to build a recent version (and cache it for CI, create packages for production, ...).

Yeah, I noticed that libvips 8.6 support is lacking, I wish we didn't have to compile from source on Travis CI (though I realized recently that we can cache that).

Would it be hard to have a requirement on 8.4+ (Debian, Ubuntu) or 8.2+ (Ubuntu LTS), and use an alternative implementation of the missing functions if at a lower version (or all the time)?

Unfortunately, it would be hard to support 8.4+ or 8.2+. The vips_thumbnail() function, which powers the vipsthumbnail functionality, was added only in 8.5. Without it we would need to implement this logic on top of vips_resize(), which would probably look like the one from carrierwave-vips, or vips-thumbnail if we're lucky. Also, libvips 8.6 adds the vips_thumbnail_image() method, which allows you to generate a thumbnail from an existing image. This has a big impact on the design of the vips backend in ImageProcessing, as it enables loading the image and generating a thumbnail to be separate, instead of having to use Vips::Image.thumbnail which does both and doesn't allow specifying various loader options.

About using the alternative implementation, I think it wouldn't make sense to use it regardless of the libvips version, as vips_thumbnail() has significant performance improvements over vips_resize(). So we'd have to have separate resize_* implementations, which would also have to accept different options (as currently they accept options that are given to vips_thumbnail()).

I know it is a bit more work but I see this as really blocking for any deployment until libvips 8.6 is available in (not outdated) distros.

What does it take to get a newer version of a package available in a distro? Is this something that we or @jcupitt can affect?

@jcupitt

This comment has been minimized.

Copy link

jcupitt replied Apr 15, 2018

Debian prioritise stability, so it just makes them rather conservative. Something like Alpine is a better choice if you want bleeding edge packages, but of course that has different issues.

The Debian package needs some work. It would be a question of opening issues on the package there:

https://packages.debian.org/sid/libvips-dev

@renchap

This comment has been minimized.

Copy link

renchap replied Apr 16, 2018

Ok, I understand why the minimum requirement, it makes sense.
I wrote a post explaining how to build up-to-date libvips packages for Debian: https://renchap.com/blog/post/building_recent_libvips_on_debian/

This might be useful for Shrine's tests on CI, I explained how I use this with CircleCI.

@janko

This comment has been minimized.

Copy link
Owner Author

janko replied Apr 16, 2018

Thanks a lot for figuring it out and sharing it, this is great! I think it would make sense to link this blog post on the libvips wiki.

@renchap

This comment has been minimized.

Copy link

renchap replied Apr 16, 2018

If you want to use this for your CI, somebody pointed out https://github.com/krobertson/deb-s3 to me. It allows you to create a debian repo in an S3 bucket very easily and is much cleaner than my shell script :)

@janko

This comment has been minimized.

Copy link
Owner Author

janko replied Apr 16, 2018

Travis CI runs builds on Ubuntu, so I think for now I'll have to continue compiling from source. But that process can be cached, as the ruby-vips repo shows, so once we make that change it should be fine.

Please sign in to comment.
You can’t perform that action at this time.