Poor text rendering with Annotate in newer Magic++
Posted: 2019-02-05T03:36:05-07:00
We recently upgraded from MSVC-2010 to MSVC-2017 and moved from ImageMagick-6.9.1-Q16 to ImageMagick-7.0.7-15.
The text rendered with Image::annotate is noticeably more jagged with the new version. Is there anything we can do to improve it?
We use this Magic++ code to read an image file (in this case plain black) and add multiple lines of text.
The text rendered with Image::annotate is noticeably more jagged with the new version. Is there anything we can do to improve it?
We use this Magic++ code to read an image file (in this case plain black) and add multiple lines of text.
Code: Select all
Magick::Image graphicImage("graphic.jpg");
resizeImage(graphicImage, 1920, 1080); // it's this size to start with
graphicImage.fillColor(Magick::Color(0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF));
graphicImage.textEncoding("UTF-8");
graphicImage.textAntiAlias(true); // without this doesn't make any difference
graphicImage.font("Ariel"); // True type font
int nLines = 16;
graphicImage.fontPointsize(((1080 / 96.0) / nLines) * 72.0);
std::string sText;
const char *pPfx = "";
for (std::vector<std::wstring>::const_iterator it = textOverlays.m_vecText.begin(); it != textOverlays.m_vecText.end(); ++it)
{
sText += pPfx;
pPfx = "\n";
sText += toUtf8(*it);
}
MagickCore::GravityType grav = MagickCore::CenterGravity;
Magick::Geometry boxSize(
(unsigned int)(1920 * 0.9),
(unsigned int)(1080 * 0.9),
(unsigned int)(1920 * 0.05),
(unsigned int)(1080 * 0.05));
graphicImage.annotate(sText, boxSize, grav);