Repository navigation
feat(image): choose the resampling filter for resizes (#1601) - #1978
Merged
KnifeLemon merged 3 commits intoDec 2, 2026
Merged
Conversation
Image presets get ImageOptions.ResizeFilter (Auto, Lanczos, Mitchell, Catmull-Rom, bilinear, box, nearest neighbour), shown under Resize in the preset editor. ApplyOptions sets it on the image before any resize, so the format caps, icons, cursors and the file-size fit use it too. Auto leaves FilterType unset, as before. The gallery allow-list and SharedPresetVersions know the field (2.6.0). Closes KnifeLemon#1601
KnifeLemon
requested changes
Dec 2, 2026
KnifeLemon
left a comment
Owner
There was a problem hiding this comment.
Thanks @cre8ive-marketing, this covers every call site from the plan (format caps, ICO/CUR, the size fit) with one helper, and the filter table in the description is very clear.
One thing to fix before merge:
- Lenient enum reading.
ImageOptions.ResizeFilterneeds[JsonConverter(typeof(LenientEnumJsonConverter<ResizeFilter>))], like the other preset enums (Rotation,Flip,FitsTiff,RasterColours…).FileeJsonContextreads enums strictly. If a later Filee adds a filter (Spline36, say), an older one would fail to read the whole presets file and reset every preset. Please add a small test likeCadOptionsTests.Cad_colours_are_saved_by_name_and_read_lenientlycovering three cases:- the filter is saved by name;
- a missing field reads as
Auto; - an unknown name reads as
Auto.
Smaller things:
ko.jsonpresets.resize_filter_hintuses 합니다체, and the app uses 해요체. Suggested: "크기를 바꿀 때 픽셀을 섞는 방식이에요. 자동은 줄일 때 Lanczos, 키울 때 Mitchell을 써요."- ICNS still hard-codes
FilterType.LanczosafterApplyOptions(IcnsConverter.cs:54). So the CHANGELOG's "for icons" covers ICO/CUR but not ICNS. Either honour the choice there, or keep Lanczos and say so. - The box is hidden when Resize is "Original size", but the filter still applies to the format caps, ICO/CUR and the file-size fit. A preset switched back to Original size keeps a hidden filter. Resetting it to Automatic when Resize goes to None would avoid that.
"Edit pictures" doesn't need to be in this PR. We can leave it for a follow-up if someone asks.
…ilter # Conflicts: # CHANGELOG.md
- ImageOptions.ResizeFilter reads leniently: a filter from a newer Filee (or a missing field) is Automatic instead of breaking presets.json. Test: saved by name, missing, unknown. - ICNS uses the preset's filter too (Automatic stays Lanczos). - The editor saves Automatic when Resize is Original size, so no hidden filter is kept. - ko.json hint in 해요체.
KnifeLemon
approved these changes
Dec 2, 2026
KnifeLemon
left a comment
Owner
There was a problem hiding this comment.
Thanks @cre8ive-marketing, all addressed: the lenient enum with its test, the ko wording, ICNS and the hidden filter reset. We'll merge once CI is green.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #1601
What changes
ImageOptions.ResizeFilter(Auto,Lanczos,Mitchell,CatmullRom,Bilinear,Box,Nearest). The default isAuto.ImageEncoder.ApplyOptionssetsimage.FilterTypeonce, before it resizes anything. Every later resize of that image uses it:FitFormat;Clonekeeps the filter).FilterTypestays unset, so ImageMagick chooses as before (Mitchell when enlarging or with alpha or a palette, Lanczos when shrinking).Filter names
CatromTriangleBoxPointFilterType.Cubic(the soft B-spline) isn't offered.CubicSpline+filter:lobes.Gallery
resizeFilteris inSharedPresetRulesas an enum rule.SharedPresetVersions.Fieldshas["presets[].image.resizeFilter"] = "2.6.0".i18n
presets.resize_filter,presets.resize_filter_hintandpresets.resize_filter.{value}are in all 23 files. "Lanczos" and "Mitchell" are names and stay as they are.Tests
ImageFormatTests.ApplyOptions_resizes_with_the_chosen_filterenlarges a 2 × 2 checkerboard 4×.Not checked
ImageEditViewModel) has no filter box yet. Say if you want it there too.