Image - an image processing library based upon Vix

I’ve just published Image version 0.43.0. It has some breaking changes (rename functions in nearly all cases). This brings the code a lot close to a 1.0 release. The remaining issue is to complete the re-write of the color handling code over the next couple of months.

Image version 0.43.0 changelog

Breaking Changes

  • Image.erode/2 and Image.dilate/2 now take a radius parameter rather than a pixels parameter. Both functions have been refactored to allow a radius in the range 1..5 with a default of 1. The radius represents the dimension of the matrix used in the Vix.Vips.Operations.range/4 function that underpins dilation and erosion. As such they represent the approximate number of pixels eroded or dilated. In addition, this function now results in a single libvips operation. The previous implementation created n operations (where n was the value of the pixels param) that could result in a slow imaging pipeline and in some cases a segfault of the entire VM due to stack space exhaustion in libvips.

  • The signature for Image.linear_gradient/{1..3} has changed. The function now takes:

    • An image and an optional keyword list of options
    • A width and height as numbers and a keyword list of options
  • Image.dominant_color/2 now returns an {:ok, rgb_color} tuple rather than a [r, g, b] list. Use Image.dominant_color!/2 if only the color value return is required.

  • Image.map_pages/2 is deprecated in favour of Image.map_join_pages/2 to better reflect the intent of the function.

Enhancements

  • Image.linear_gradient/{1..3} now takes an :angle option which determines the angle of the gradient in degrees. Thanks to @severian1778 for considerable patience. Closes #67.

  • Improve options handling and documentation for Image.radial_gradient/3.

  • Add Image.radial_gradient!/3 to mirror Image.radial_gradient/3.

  • Add Image.dominant_color!/2 to mirror Image.dominant_color/2.

  • Add Image.extract_pages/1 which will extract the pages of a multi-page image into a list of separate images.

9 Likes