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

How to save output to a png file? #5

Closed
Honghe opened this issue Feb 4, 2021 · 6 comments
Closed

How to save output to a png file? #5

Honghe opened this issue Feb 4, 2021 · 6 comments

Comments

@Honghe
Copy link

Honghe commented Feb 4, 2021

For ASCII art, there is a tool https://github.com/ansilove/ansilove to save the output as a png file.
So how to save img2utf output, which contains non ASCII chars, to a png file?

@lf94
Copy link
Owner

lf94 commented Feb 4, 2021

You could use imagemagick's convert command to print the text:

convert -background white -fill black -font 'a font which supports all the necessary glyphs' label:@the-file-containing-the-text output.png

@lf94
Copy link
Owner

lf94 commented Feb 4, 2021

That's what I'm doing for my use-case:

is-privacy-in-our-evolutionary-interest txt

@lf94 lf94 closed this as completed Feb 4, 2021
@lf94
Copy link
Owner

lf94 commented Feb 4, 2021

I'm using FairfaxSMHD.ttf font.

@Honghe
Copy link
Author

Honghe commented Feb 4, 2021

@lf94 I still have problem of converting with “ width or height exceeds limit”.

MAGICK_WIDTH_LIMIT=200MP MAGICK_HEIGHT_LIMIT=200MP convert -background white -fill black -font 'UbuntuMono-R.ttf' label:@p.ansi output.png
convert-im6.q16: width or height exceeds limit `@p.ansi' @ error/label.c/ReadLABELImage/138.
convert-im6.q16: no images defined `output.png' @ error/convert.c/ConvertImageCommand/3258.

p.ansi file content:
image

@Honghe
Copy link
Author

Honghe commented Feb 4, 2021

@lf94 How can I know which fonts support all the necessary glyphs?

@lf94
Copy link
Owner

lf94 commented Feb 4, 2021

Any font which supports the Symbols for Legacy Computing block. The font I wrote supports it. 🙂

That error you hit is because of Imagemagick policy, located somewhere in /etc/. Remove the policy about width. I think policies exist to prevent imagemagick from exceeding certain memory restrictions and other things.

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

2 participants