Skip to content
This repository was archived by the owner on Oct 8, 2024. It is now read-only.
This repository was archived by the owner on Oct 8, 2024. It is now read-only.

Make better image accuracy by improving the algorithm #27

@inshinno

Description

@inshinno

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions