Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make better image accuracy by improving the algorithm #27

Open
strear opened this issue Jan 3, 2022 · 0 comments
Open

Make better image accuracy by improving the algorithm #27

strear opened this issue Jan 3, 2022 · 0 comments

Comments

@strear
Copy link

strear commented Jan 3, 2022

Now, gif-for-cli still uses a predefined constant . ,\'-:;!" ^/+? *&8#$@% to match the brightness and generate the image, like all similar tools do. This approach does not make effective use of all the visible characters in the ASCII character set, and some uneven symbols like ^ and , would give the output image a "broken" feel.

Perhaps we can introduce a kind of "oversampling" method: since the input is a bitmap, we could also divide the glyph of each character into 𝑛² pieces (say 4 or 9 pieces), and compare in the scaled original image for an equally sized area. By using an optimized 𝑘-d tree (𝑘 = 𝑛²), the single most accurate character can be found instantly for each 𝑛² pixels. This would be a major improvement for gif-for-cli.

Screenshot 2022-01-03 123405

Screenshot 2022-01-03 125115

Original: http://9front.org/img/9iknowthis01.png

I have written an example implementing this idea for reference (strear/saam), but its code is in C++. Do the maintainers and the pull request people have any good ideas on how to merge this implementation in?

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

No branches or pull requests

1 participant