Skip to content

Fix warp_perspective/straighten_perspective :extend_mode silent no-op and correct its docs#203

Merged
kipcole9 merged 1 commit into
elixir-image:mainfrom
hlindset:fix/warp-perspective-extend-mode
Jun 30, 2026
Merged

Fix warp_perspective/straighten_perspective :extend_mode silent no-op and correct its docs#203
kipcole9 merged 1 commit into
elixir-image:mainfrom
hlindset:fix/warp-perspective-extend-mode

Conversation

@hlindset

Copy link
Copy Markdown
Contributor

Fixes the :extend_mode option on warp_perspective/straighten_perspective, which was silently a no-op.

Root cause: Image.Options.WarpPerspective validated :extend_mode and passed it straight through to Vix.Vips.Operation.mapim/3, but the operation's option is named :extend. mapim silently ignores unknown options, so the value never took effect, and output was always rendered with mapim's own default (extend: background).

  • Image.Options.WarpPerspective now renames :extend_mode to :extend during validation, so the value reaches mapim/3.
  • Default :extend_mode changed from :black to :background. The configured :black was never actually in use. The actual rendered default was mapim's background. Setting the configured default to :background keeps output at the default identical to before.
  • Corrected the :extend_mode docs on warp_perspective/4, warp_perspective!/4, straighten_perspective/3 and straighten_perspective!/3. Like affine, mapim's extend only colours the thin antialiased fringe at the resampled content edge, not the uncovered canvas (which is filled by :background).

Anyone who has explicitly set :extend_mode to a value other than :background will see changes to the fringes around the resampled content.

@kipcole9 kipcole9 merged commit 8486aa1 into elixir-image:main Jun 30, 2026
6 checks passed
@kipcole9

Copy link
Copy Markdown
Collaborator

Wow, you're doing some amazing and truly appreciated work. Thank you. I will consolidate all your work and get a new release out by my Wednesday morning (UTC+10).

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