# `Image.Options.Affine`
[🔗](https://github.com/elixir-image/image/blob/v0.72.0/lib/image/options/affine.ex#L1)

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`.

# `affine_options`

```elixir
@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`

```elixir
@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`

```elixir
@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

# `validate_options`

```elixir
@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 `t:Image.Options.Affine.affine_options/0`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
