Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: add lanczos interpolation implementation#734

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
Zekfad wants to merge3 commits intobrendan-duncan:main
base:main
Choose a base branch
Loading
fromZekfad:main

Conversation

@Zekfad
Copy link

@ZekfadZekfad commentedMay 4, 2025
edited
Loading

based on MIT licensedhttps://github.com/Megakuul/image_scaler/blob/main/lib/lanczos.dart

resize works good, but I'm not sure if that's correct implementation forgetPixelLanczos
it produces good results for down sampling, but upscaling is not good comparing to resize (because of missing precise scale factor?)
i've compared it by using fall back (last else before) instead of dedicated switch case.

@ZekfadZekfad marked this pull request as draftMay 4, 2025 15:00
@brendan-duncan
Copy link
Owner

Nice! I'll take a look at this soon when I get a chance.

@brendan-duncan
Copy link
Owner

I did some quick tests and it seems to not deal with alpha correctly, at least for resizing.
copyResize_downscale_cubic
copyResize_downscale_lanczos

@Zekfad
Copy link
Author

I'll look into this at the next week, aglo probably needs more tweaking and that alpha issue

brendan-duncan reacted with thumbs up emoji

@ZekfadZekfad closed thisMay 23, 2025
fixes alpha issue, uses oklab linear color spacefor better preservation of detailsimplemented via SIMD operationsfor a better performance
@ZekfadZekfad reopened thisMay 23, 2025
@Zekfad
Copy link
Author

@brendan-duncan fixed alpha issue and made some performance adjustments, I'm very pleased with downscaling results as of now

@ZekfadZekfad marked this pull request as ready for reviewMay 23, 2025 01:43
@brendan-duncan
Copy link
Owner

Awesome, I'll check it out soon. Thanks!

@Zekfad
Copy link
Author

I'm refactoring code right now, is resize.dart even used anywhere beside tests? Its part of src (internal files), but I cant see any references to resize function of itself.

@ZekfadZekfad marked this pull request as draftMay 23, 2025 16:16
@brendan-duncan
Copy link
Owner

resize.dart was a request to be able to do in-place resizing of images, as apposed to copyResize which always makes a copy, and is an exported function.

@Zekfad
Copy link
Author

Zekfad commentedMay 23, 2025
edited
Loading

Thanks for reply, missed the export sorry.

I've tried to iterate on algo to fix it for upscaling, but no luck. If you're good with this particular implementation of interpolation being good for downscaling but bad for upscaling I probably should update docs for it and add explicit note.

I lack proper knowledge about image processing, so I think I leave this version for now, maybe in future when I'll have some more time I'll try to dig deeper about convolution filters and fix this implementation.
For future I think it should be implemented similar to this:https://github.com/richgel999/imageresampler/blob/master/resampler.cpp
Its the easiest to understand resampler implementation I've found so far.

Also some related links:
https://clouard.users.greyc.fr/Pantheon/experiments/rescaling/index-en.html
https://entropymine.com/imageworsener/
https://github.com/pixelflinger/lanczos-2d/tree/main
http://www.ericbrasseur.org/gamma.html

@brendan-duncan
Copy link
Owner

I'm not forgetting about this, just been busy with the family

@Zekfad
Copy link
Author

No worries about that!

I've also found some issues with downscaling very big images to a very small, such as 1024->64, alpha looks inverted for some reason.

Can't give any dates, due to work, but I plan on changing this to a different approach - make a new file and implement convolution based scaling as in links I mentioned, so I think you can ignore pr this for a while.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

No reviews

Assignees

No one assigned

Labels

None yet

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

2 participants

@Zekfad@brendan-duncan

[8]ページ先頭

©2009-2025 Movatter.jp