Skip to content

Expose :interpolate and route :background through Image.Pixel.to_pixel/2 in Image.rotate/3#204

Merged
kipcole9 merged 3 commits into
elixir-image:mainfrom
hlindset:feat/rotate-background-interpolate
Jun 30, 2026
Merged

Expose :interpolate and route :background through Image.Pixel.to_pixel/2 in Image.rotate/3#204
kipcole9 merged 3 commits into
elixir-image:mainfrom
hlindset:feat/rotate-background-interpolate

Conversation

@hlindset

@hlindset hlindset commented Jun 30, 2026

Copy link
Copy Markdown
Contributor
  • Image.rotate/3 now exposes :interpolate (:nearest, :bilinear (default), :bicubic, :lbb, :nohalo, :vsqbs), resolved to a Vix.Vips.Interpolate via Image.Options.Rotate. It has no effect on rotations by a multiple of 90, which copy source pixels directly.
  • :background now accepts all valid Image.Pixel.to_pixel/2 values, or :average, matching Image.affine/3. Previously it only accepted a bare numeric list and could not express RGBA. Default is kept as libvips' native default (transparent on alpha images, opaque black otherwise).
  • Image.Options.Rotate.invalid_option/1 now returns an %Image.Error{} - is this ok to just switch, or would you rather I kept that out?

Docs:

  • Added a ## Partially-transparent backgrounds section. A fully opaque or fully transparent :background is reproduced exactly, while a partially transparent one is scaled by max / alpha because libvips injects the fill into premultiplied-alpha space and unpremultiplies on output. For an exact partial-alpha fill, the section documents a rotate over transparent then Image.compose/2 recipe.
  • Replaced the vague/inaccurate displacement notes with a ## Displacements section reusing the affine wording for :idx/:idy/:odx/:ody.

A PR that changes Image.affine/3 to use libvips native default (probably the expected behaviour) instead of explicit :black as the default (+ a note about the alpha background caveat) is coming up. Missed these nuances in the original affine PR.

@kipcole9 kipcole9 merged commit 5bb98af into elixir-image:main Jun 30, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants