Text images with unicode chars looking blurry.
Posted: 2018-03-04T03:56:11-07:00
I want imagemagick to create an image of unicode chars that is sharp and accurate. And my attempts with ttf fonts worked okay, but didn't look exactly right. So I tried again with the fixed bitmap font, which I read has good unicode support, but the unicode chars failed to render at all. Disappointing.
So in short, I ask if there is a better way please. The images below are enlarged so you can better see aliasing, blurring etc.
1] Firstly, I have echoed some unicode chars in urxvt terminal with dejavu 18pt ttf font. Nice and sharp, as desired.
2] Next, I created an image of a unicode message using dejavu 14pt ttf font. Some blurring though.
3] Now, I created the same unicode text, but with anti-aliasing disabled. Sharp, but still looking odd.
4] Lastly, I create text image with IM using the fixed bitmap font. But the unicode chars failed to render at all.
In short, none of the methods I've used above have given me nice sharp unicode cahrs in an image. So I ask, is there a better way.
So in short, I ask if there is a better way please. The images below are enlarged so you can better see aliasing, blurring etc.
1] Firstly, I have echoed some unicode chars in urxvt terminal with dejavu 18pt ttf font. Nice and sharp, as desired.
Code: Select all
echo -ne "aaa \u259A bbb \u256c ccc \u2591 ddd"
2] Next, I created an image of a unicode message using dejavu 14pt ttf font. Some blurring though.
Code: Select all
msg=$(echo -ne "aaa \u259A bbb \u256c ccc \u2591 ddd")
convert -font DejaVu-Sans-Mono-Bold -pointsize 14 label:"$msg" out.png
3] Now, I created the same unicode text, but with anti-aliasing disabled. Sharp, but still looking odd.
Code: Select all
msg=$(echo -ne "aaa \u259A bbb \u256c ccc \u2591 ddd")
convert -font DejaVu-Sans-Mono-Bold -pointsize 14 +antialias label:"$msg" out.png
4] Lastly, I create text image with IM using the fixed bitmap font. But the unicode chars failed to render at all.
Code: Select all
msg=$(echo -ne "aaa \u259A bbb \u256c ccc \u2591 ddd")
bitmapfont='-misc-fixed-bold-r-normal--15-140-75-75-c-90-iso8859-1'
convert -font $bitmapfont label:"$msg" out.png
In short, none of the methods I've used above have given me nice sharp unicode cahrs in an image. So I ask, is there a better way.
Code: Select all
$ identify -version
Version: ImageMagick 6.9.9-34 Q16 x86_64 20180122 http://www.imagemagick.org
Copyright: © 1999-2018 ImageMagick Studio LLC
License: http://www.imagemagick.org/script/license.php
Features: Cipher DPC Modules OpenMP
Delegates (built-in): bzlib djvu fftw fontconfig freetype jbig jng jp2 jpeg lcms lqr ltdl lzma openexr pangocairo png tiff wmf x xml zlib