I am wondering if anyone else has run into this. From what I understand when you set the image density and the font size renders in relation to this (points)
http://www.imagemagick.org/Usage/text/#pointsize
I am creating an online preview of a business card. The preview is supposed to be 171 PPI and am setting the DrawablePointSize to "10".
The image is getting saved at 171 PPI which I want but the font is rendering in size as if the low res preview was 72 PPI. Here is the caption function I am using for each text field:
http://www.imagemagick.org/Usage/text/#pointsize
I am creating an online preview of a business card. The preview is supposed to be 171 PPI and am setting the DrawablePointSize to "10".
The image is getting saved at 171 PPI which I want but the font is rendering in size as if the low res preview was 72 PPI. Here is the caption function I am using for each text field:
public void WriteCaption(MagickImage Background, string Txt, double PPI, string fontFamily, double fontSize, string FontColor, int CaptionX, int CaptionY, int CaptionW, int CaptionH, string TextAlign)
{
if (!String.IsNullOrEmpty(Txt))
{
var bgColor = new MagickColor(Color.Transparent);
var fillColor = new MagickColor("#000000");
if (!String.IsNullOrEmpty(FontColor))
{
fillColor = new MagickColor(FontColor.Replace("0x", "#"));
}
Background.Density = new PointD(PPI, PPI);
using (MagickImage Caption = new MagickImage(bgColor, CaptionW, CaptionH))
{
Caption.Density = new PointD(PPI, PPI);
Caption.Format = MagickFormat.Png;
Caption.HasAlpha = true;
Caption.VirtualPixelMethod = VirtualPixelMethod.Transparent;
var gravity = new DrawableGravity(Gravity.West);
if (TextAlign.ToLower() == "center")
{
gravity = new DrawableGravity(Gravity.Center);
}
if (TextAlign.ToLower() == "right")
{
gravity = new DrawableGravity(Gravity.East);
}
DrawableTextAntialias txtDrawableTextAntialias = new DrawableTextAntialias(true);
DrawableText txtDrawableText = new DrawableText(0, 0, Txt + " " + fontSize);
DrawablePointSize txtDrawablePointSize = new DrawablePointSize(fontSize);
DrawableFont txtDrawableFont = new DrawableFont(fontFamily);
DrawableFillColor txtDrawableFillColor = new DrawableFillColor(fillColor);
Caption.Draw(txtDrawableTextAntialias, txtDrawableText, txtDrawablePointSize, txtDrawableFont, txtDrawableFillColor,gravity);
Background.Composite(Caption,CaptionX, CaptionY, CompositeOperator.Over);
}
}
}