Skip to content

feat(presets): a minimum short edge resize that only enlarges (#652) - #687

Merged
KnifeLemon merged 1 commit into
mainfrom
feat/min-short-edge
Oct 27, 2026
Merged

KnifeLemon merged 1 commit into
mainfrom
feat/min-short-edge

Conversation

@KnifeLemon

Copy link
Copy Markdown
Owner

What does this change?

Closes #652.

The resize list in the preset editor gets one more choice, Set a minimum short edge, with one number box (16-16384 px, default 1080). A picture whose shorter edge is under that number is scaled up in proportion until the shorter edge reaches it. A picture that already reaches it is left alone; this mode never shrinks anything. The box has a tooltip saying so.

  • Stored like Custom from feat(presets): a custom resize, free width and height with an aspect lock (#576) #593. The preset keeps "resize": "None" and gets a separate "minShortEdge": 1080. Filee 2.1.0 reads that file without trouble: it skips the property it doesn't know and doesn't resize. ResizeModeJsonConverter never writes the new mode's name, and presets without it don't gain a minShortEdge entry.
  • Values from a hand-edited file: 0 or below is ignored, and anything else is brought into 16-16384. The enlargement also stops at the pixel count of a 16384 x 16384 picture, so a 16 x 4000 strip asked for 4000 doesn't turn into 4 billion pixels.
  • Enlarging uses ImageMagick's default filter, the same as Percent above 100 % and the locked custom size.
  • Format limits and the size limit still apply afterwards, as for every other mode. WebP, AVIF and JPG come back down to the sides they can store, an ICO still tops out at 256 px, and a picture over its size limit (Plan for approval: Fit to a place, Undo a conversion, Phone drop #553) is made smaller again after it was enlarged.
  • SVG is drawn at the needed size, not enlarged as a bitmap afterwards. PDF page runs are planned at the scale this mode will use.

Not in this PR: the "Edit pictures" window from #617 isn't merged yet, so it doesn't list this mode. A follow-up will add Custom and this mode there together. No settings schema change is needed, because no built-in preset changes.

Type of change

  • Bug fix
  • New feature or improvement
  • New format or engine
  • Translation
  • Documentation
  • Build, CI or dependencies

How was it tested?

  • dotnet format --verify-no-changes
  • dotnet test: the full Core suite, plus the related Engines and App tests: ImageAndPdfTests, GraphicsTests, SizeLimitTests, the preset editor render tests, DonutGroupTests and the localization tests
  • Tried it in the app (what you converted or clicked, and on which OS):

New tests:

  • Core: a preset with a minimum short edge writes resize: "None" plus minShortEdge (every resize name is one 2.1.0 knows, and other presets don't get the property). It reads back, clones, and counts as a picture edit. ResizeMode.MinShortEdge itself is never written.
  • Engines: enlarging in proportion (landscape, portrait, and an uneven factor that still lands exactly on the minimum). Nothing shrinks when the picture is large or already exact. Values of 0 or below and out-of-range values from a file. The pixel cap on a hairline strip. WebP's side limit after enlarging. A JPG conversion and an ICO conversion (256 px cap). The size limit still winning after enlarging. The PDF run planning scale, with Custom taking precedence when a file carries both. SVG rendered at 2160 x 1080 for a 400 x 200 drawing with a 1080 minimum, and the vector render scale left alone when the usual size already meets the minimum.
  • App: the box appears when the mode is picked, has no spinner, and saves as None + MinShortEdge. The value is clamped. Switching to Custom or any other mode clears it, and a hand-edited value of 0 or below opens as the preset's own resize. Same-format presets with this mode are offered for images only.

Screenshots (UI changes)

Rendered headlessly by Min_short_edge_shows_its_field_and_never_writes_a_name_older_versions_reject (en, de, ar; light and dark): tests/Filee.App.Tests/bin/<config>/net10.0/screenshots/preset-min-short-edge-*.png.

Checklist

  • New UI strings are in all src/Filee.App/Assets/i18n/*.json files
  • New third-party code or binaries are listed in THIRD-PARTY-NOTICES.md (none)
  • The PR does one thing (unrelated changes go in a separate PR)

🤖 Generated with Claude Code

The preset editor's resize list gains "Set a minimum short edge": a picture
whose shorter edge is under N px is scaled up in proportion until it reaches
N; one that already does is left untouched (it never shrinks).

Stored like the custom size from #593: resize "None" plus a separate
minShortEdge number, so Filee 2.1.0 keeps reading presets.json (it skips the
unknown property and does not resize). The resize converter never writes the
new mode's name. Values from a hand-edited file are brought into 16-16384,
0 or below is ignored, and the enlargement stops at 16384 x 16384 worth of
pixels so a hairline strip cannot ask for gigapixels.

Enlarging uses ImageMagick's default filter, as Percent above 100 % does. The
format's own limits (WebP/AVIF/JPG sides, ICO 256) and the size limit still
apply afterwards. SVG sources are rendered at the needed size instead of
being enlarged as a bitmap, and PDF page runs are planned at the scale the
resize will use.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added the feature New features label Oct 27, 2026
@KnifeLemon
KnifeLemon merged commit 6d3cfd1 into main Oct 27, 2026
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature New features

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Suggestions for the image function

1 participant