Image.Options.Affine (image v0.72.0)

Copy Markdown View Source

Options and option validation for Image.affine/3.

These options are shared by the affine family of transformations: Image.affine/3, Image.translate/4 and Image.shear/4.

Summary

Types

The options applicable to an affine transformation.

How the interpolator synthesizes the one-pixel fringe just beyond the content edge when resampling boundary pixels.

The interpolators that may be selected with the :interpolate option (descriptions from vips -l interpolate)

Types

affine_options()

@type affine_options() :: [
  idx: number(),
  idy: number(),
  odx: number(),
  ody: number(),
  interpolate: interpolate(),
  background: Image.BackgroundColor.spec() | nil,
  extend_mode: extend_mode(),
  output_area: [integer()]
]

The options applicable to an affine transformation.

extend_mode()

@type extend_mode() :: :background | :copy

How the interpolator synthesizes the one-pixel fringe just beyond the content edge when resampling boundary pixels.

  • :background (the default) blends the fringe toward the :background color. This is correct whenever the transform exposes canvas.
  • :copy clamps to the nearest content pixel. Use it when the content fills the whole canvas, where the default would leave a faint border along the outermost row and column.

interpolate()

@type interpolate() :: :nearest | :bilinear | :bicubic | :lbb | :nohalo | :vsqbs

The interpolators that may be selected with the :interpolate option (descriptions from vips -l interpolate):

  • :nearest - nearest-neighbour interpolation
  • :bilinear (default) - bilinear interpolation
  • :bicubic - bicubic interpolation (Catmull-Rom)
  • :lbb - reduced halo bicubic
  • :nohalo - edge sharpening resampler with halo reduction
  • :vsqbs - B-Splines with antialiasing smoothing

Functions

validate_options(image, options)

@spec validate_options(Vix.Vips.Image.t(), Keyword.t()) ::
  {:ok, Keyword.t()} | {:error, Image.error()}

Validate the options for Image.affine/3.

The image is required to resolve the :background option into a pixel matching the image's bands and color space.

See Image.Options.Affine.affine_options/0.