I have a webcam and want to add some annotations to image, but antialiasing works strange. I'll try to explain:
I have an image like this:
Then I add semi-transparent rectangle and put text over it:
// add background black rectangle
$draw->setFillColor('black');
$draw->setFillOpacity(0.5);
$draw->rectangle( 0, 10, $cam['width'], 70 ); // Draw the rectangle
// add lead text
$draw->setFont('ARIALBD.TTF');
$draw->setFontSize(14);
$draw->setFillColor('white');
$draw->annotation(20, 35, $cam['text']);
// add timestamp
$draw->setFont('ARIAL.TTF');
$draw->setFontSize(12);
$draw->setFillColor(new ImagickPixel('#f3ac01'));
$draw->annotation(20, 50, date("Y-m-d H:i:s"));
$img->drawImage($draw);
And get something like this:
Huh, but timestamp looks ulgy(look at minutes/seconds). Trying to disable antialiasing:
$draw->setTextAntialias(false);
and now it looks still ugly(look at hours), but now it has sharp edges:
How can I get result with smart antialiasing, like this(I know PS uses own antialiasing, but IMagickDraw deal real bad result):
For me it looks more like the compression level of the whole image when saved than the antialiasing, have a look at setCompressionQuality, and tweak the compression quality until you avoid the "blurriness" you have in the picture.