Skip to content

feat(oiiotool): flexible offset notation with commas#5209

Open
lgritz wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
lgritz:lg-geomformat
Open

feat(oiiotool): flexible offset notation with commas#5209
lgritz wants to merge 2 commits into
AcademySoftwareFoundation:mainfrom
lgritz:lg-geomformat

Conversation

@lgritz
Copy link
Copy Markdown
Collaborator

@lgritz lgritz commented May 20, 2026

Fixes #5207

Sometimes the WxH+X+Y and +X+Y notation (borrowed from X11!) can be a little awkward. This patch extends the accepted syntax to allow commas to separate the offset components, for example also accepting WxY,X,Y and X,Y.

This affects the commands

--create
--crop
--cut
--fit
--fullsize
--origin
--originoffset
--paste
--pattern
--printstats
--resize

Fixes 5207

Sometimes the `WxH+X+Y` and `+X+Y` notation (borrowed from X11!) can
be a little awkward. This patch extends the accepted syntax to allow
commas to separate the offset components, for example also accepting
`WxY,X,Y` and `X,Y`.

This affects the commands

    --create
    --crop
    --cut
    --fit
    --fullsize
    --origin
    --originoffset
    --paste
    --pattern
    --printstats
    --resize

Signed-off-by: Larry Gritz <lg@larrygritz.com>
@lgritz lgritz added the oiiotool oiiotool label May 22, 2026
@lgritz lgritz requested a review from Copilot May 23, 2026 19:47
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Extends oiiotool's geometry parsing to accept a comma-separated alternative (WxH,X,Y and X,Y) in addition to the X11-style WxH+X+Y / +X+Y form. This resolves an awkward case where signed-prefix syntax breaks when offset components are produced by expressions whose sign isn't known in advance (issue #5207).

Changes:

  • Update scan_offset and scan_res_offset to try the legacy +/- syntax first and fall back to comma-separated parsing.
  • Add unit tests for the comma-separated forms in unit_test_adjust_geometry, and add CLI runtime tests in the oiiotool-attribs testsuite.
  • Document the new comma-syntax form across all affected commands in oiiotool.rst.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/oiiotool/oiiotool.cpp Extends scan_offset/scan_res_offset to accept comma-separated origin/offset; adds unit tests.
src/doc/oiiotool.rst Documents new comma notation for --create, --crop, --cut, --fit, --fullsize, --origin, --originoffset, --paste, --pattern, --printstats, --resize.
testsuite/oiiotool-attribs/run.py Adds runtime tests covering both X11 and comma origin/originoffset syntax.
testsuite/oiiotool-attribs/ref/out.txt Updates expected output to match new tests.
testsuite/oiiotool-attribs/ref/out-jpeg9d.txt Updates expected output for jpeg9d variant to match new tests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/doc/oiiotool.rst Outdated
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Signed-off-by: Larry Gritz <lg@larrygritz.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

oiiotool oiiotool

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: oiiotool --offset syntax is not good with expressions

2 participants