Skip to content

What's_New_in_7.18

John Cupitt edited this page Mar 29, 2017 · 1 revision

title: What's New in 7.18 permalink: /What's_New_in_7.18/

This page summarises the changes for version 7.18. We have a detailed VIPS ChangeLog and nip2 ChangeLog, but as headlines:

New interpolation system : When you resize or rotate an image, you can now select the type of interpolation you'd like to use. As well as fast versions of the standard interpolators, we have a couple of interesting experimental ones. See below for details. We have a page of Interpolation samples.

Support for Radiance files : You can load and save Radiance images (*.hdr). This is a file format commonly used for HDR imaging.

Support for Matlab save files : You can now load Matlab save files (*.mat) directly into nip2. It loads the first matrix object in the file as an image. No save to Matlab yet though.

Faster image painting : nip2's image display system has been sped up again, hopefully it looks a bit better.

Better progress feedback : More changes to the progress feedback system should make it feel faster and more responsive.

New object system : We've designed an object system for VIPS. Hopefully, this will become the base for a new API replacing the current rather crusty one. See below for details.

Plus the usual minor speed-ups, enhancements and bug fixes. What's New in 7.16 is still there if you're interested.

New interpolation system

We have a new image transform operator, im_affinei(). This performs a general affine transform, taking an image interpolator as a parameter. We have a whole family of interpolators to chose from:

  • Nearest neighbour
  • Bilinear
  • Bicubic (Catmul-Rom)
  • Nohalo1 (Bilinear with edge enhancement)
  • Snohalo1 (Bilinear with edge smoothing)
  • Yafrsmooth (Bicubic with edge enhancement)

Most of the image transformers are implemented on top of im_affinei(), so you'll find most transformers in nip2 now have a set of extra options.

You should find that there's a good quality improvement whenever you transform an image.

New object system

VIPS currently has a pretty crusty old API designed in 1990. We tried to make a clean break for vips8 a few years ago, but it didn't work out. The effort required rewriting everything in one huge push was just too great.

The new plan is to take some of the work done on the vips8 project and slowly move the existing code on top of it. So: we now have a base class, VipsObject, built on top of the standard GObject system, and the new interpolation system is built on top of this. We've also moved the pluggable image formats introduced in 7.16 over to this new framework.

We hope to move more VIPS types, such as IMAGE, over as well, and then to start to rebuild VIPS operations like im_add() in this new object framework. This will give us a nice new API in a series of gradual steps. Hopefully. The VIPS manual has sections on VipsObject and its subclasses with details.

Try this:

$ vips --list classes
VipsFormatVips (vips), VIPS, (.v) is_a header load save get_flags
VipsFormatJpeg (jpeg), JPEG, (.jpg, .jpeg, .jpe) is_a header load save
VipsFormatPng (png), PNG, (.png) is_a header load save
VipsFormatCsv (csv), CSV, (.csv) header load save
VipsFormatPpm (ppm), PPM/PBM/PNM, (.ppm, .pgm, .pbm) is_a header load save get_flags
VipsFormatAnalyze (analyze), Analyze 6.0, (.img, .hdr) is_a header load get_flags
VipsFormatExr (exr), OpenEXR, (.exr) is_a header load get_flags
VipsFormatMat (mat), Matlab, (.mat) is_a header load
VipsFormatRad (rad), Radiance, (.hdr) is_a header load save
VipsFormatMagick (magick), libMagick-supported, () is_a header load
VipsFormatTiff (tiff), TIFF, (.tif, .tiff) is_a header load save get_flags
VipsInterpolateNearest (nearest), Nearest-neighbour interpolation
VipsInterpolateBilinear (bilinear), Bilinear interpolation
VipsInterpolateBicubic (bicubic), Bicubic interpolation (Catmull-Rom)
VipsInterpolateYafrsmooth (yafrsmooth), Bicubic plus edge enhance
VipsInterpolateNohalo1 (nohalo1), Edge-enhancing bilinear
VipsInterpolateSnohalo1 (snohalo1), Nohalo level 1 with antialiasing blur

The --list classes option walks the hierarchy below VipsObject printing all the concrete classes with their properties. You can use a class like this:

$ vips im_affinei_all fred.jpg jim.jpg yafrsmooth{sharpening=2} 1.5 0 0 1.5 0 0

VIPS knows that the third argument to im_affinei_all() is an interpolator, so it searches the classes below VipsInterpolate for a class whose nickname is yafrsmooth. It builds an instance of the class, setting the optional construct parameter sharpening to 2.

This is all done by introspection. You can add your own subclasses of VipsInterpolate and use them with the same interface.

You can do this in nip2 as well. Try:

vips_object_new "VipsInterpolateYafrsmooth" [] [$sharpening => 2]

You can get a list of properties with

dir A1

(assuming your object is A1) and fetch them with something like

A1.description

Clone this wiki locally