How to avoid smaller annotated text break-up?
Posted: 2009-06-13T16:14:46-07:00
Hello, this problem had puzzled me much long time.
When I annotate some small text (equal to or samller than 12px) on the picture, it looks very ugly and seems break up when I trun off the antialias effect.
Let's look following three pictures(I drew these pictures use PHP MagickWand extension & PHP-Gd2 extension)
1. Drew use ImageMagick-6.5.3-6 without antialias:
2. Drew use ImageMagick-6.5.3-6 with antialias:
3. Drew use PHP-GD2 (the text looks very clear):
How can I deal with this problem? I think this is not a FONT problem, maybe it can be fixed by modifing code on magick/annotate.c, but I cann't resolved it...
--
I generate the two images use these Command, used the same font file for GD.
The TTC Font file can be downloaded from here: http://www.czxiu.com/~hightman/simsun.tar.bz2(about 5.3MB)
The text annotated on the image was break-up, It seems these error was fixed in GD-lib along with a special algorithm.
gd used in PHP, php script run at the same machine ImageMagick installed, they are using same FreeType-2.3.7
--
The problem code maybe here, (magick/annotate.c), but I dont know how to fix or adjust them...
...
1291 fill_opacity=(MagickRealType) (*p)/255.0;
1292 if (draw_info->text_antialias == MagickFalse)
1293 fill_opacity=fill_opacity > 0.5 ? 1.0 : 0.0;
1294 if (active == MagickFalse)
1295 q=GetCacheViewAuthenticPixels(image_view,x_offset,y_offset,1,1,
1296 exception);
...
When I annotate some small text (equal to or samller than 12px) on the picture, it looks very ugly and seems break up when I trun off the antialias effect.
Let's look following three pictures(I drew these pictures use PHP MagickWand extension & PHP-Gd2 extension)
1. Drew use ImageMagick-6.5.3-6 without antialias:
2. Drew use ImageMagick-6.5.3-6 with antialias:
3. Drew use PHP-GD2 (the text looks very clear):
How can I deal with this problem? I think this is not a FONT problem, maybe it can be fixed by modifing code on magick/annotate.c, but I cann't resolved it...
--
I generate the two images use these Command, used the same font file for GD.
Code: Select all
convert -size 60x20 xc:lightblue -font simsun.ttc -pointsize 12 -fill black +antialias -annotate +3+15 "试试看" test1.jpg
convert -size 60x20 xc:lightblue -font simsun.ttc -pointsize 12 -fill black -antialias -annotate +3+15 "试试看" test2.jpg
The text annotated on the image was break-up, It seems these error was fixed in GD-lib along with a special algorithm.
gd used in PHP, php script run at the same machine ImageMagick installed, they are using same FreeType-2.3.7
Code: Select all
<?php
$im = imagecreate(60, 20);
$bg = ImageColorAllocate($im, 255, 255, 255);
$fg = imagecolorallocate($im, 0, 0, 0);
ImageFill($im, 0, 0, $bg);
ImageFTText($im, 9, 0, 3, 15, $fg, "simsun.ttc", "试试看");
header("Content-Type: image/jpeg");
ImagePng($im);
?>
The problem code maybe here, (magick/annotate.c), but I dont know how to fix or adjust them...
...
1291 fill_opacity=(MagickRealType) (*p)/255.0;
1292 if (draw_info->text_antialias == MagickFalse)
1293 fill_opacity=fill_opacity > 0.5 ? 1.0 : 0.0;
1294 if (active == MagickFalse)
1295 q=GetCacheViewAuthenticPixels(image_view,x_offset,y_offset,1,1,
1296 exception);
...