fix(post): remove max_chars budget cap for ASCII art#16
Open
thedarkknight197 wants to merge 2 commits into
Open
fix(post): remove max_chars budget cap for ASCII art#16thedarkknight197 wants to merge 2 commits into
thedarkknight197 wants to merge 2 commits into
Conversation
Replace dense 70-char gradient with threshold-based sparse mapping: - Pixels above threshold (default 140) → space (sky/background areas) - Pixels below threshold → @%#*+=-: character set (shadows/edges only) - Result: airy asciiart.eu style where whitespace creates the image
Art is embedded in an HTML comment and explicitly exempt from the post character limit. Capping it to the remaining text budget forced portrait images down to ~38 chars wide, producing unreadable output. Remove the budget constraint so img2ascii runs at full quality (80 chars wide by default).
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.
Problem
When publishing a post with an image,
_convert_image_to_artcapped the art to the remaining character budget (max_chars - text_len - 20). For a typical post with ~100 chars of text, this left ~860 chars for the art.With a portrait photo (e.g. 3024×4032), the
max_charsconstraint inimage_to_asciishrinks width iteratively until the art fits — converging to ~38 chars wide. The result is unrecognizable noise.Fix
Remove the budget constraint entirely. ASCII art is already exempt from the post character limit (added in #13:
has_imagecheck skips themax_charsvalidation on text). There's no reason to cap the art separately — it lives in an HTML comment and doesn't affect readability.Art now generates at full quality: 80 chars wide by default.
Before vs After
Before (38 chars wide — unrecognizable):
After (80 chars wide — Ferrari + person + Dubai skyline clearly visible):