-
Hello, Additionally, I would like to ask how I could programmatically, given an input of a background color and a list of strings, be able to make it automatically calculate the needed font size as well as keep a margin so that it still fits and looks nicely. Any help and pointing to resources are appreciated. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Your first question is not easy to answer. It all depends on what else you want to do or which kinds of formats you want to support so I don't have an answer to that question. But using my library could be one of your options. And if you use this library you can read an image with a label that fits in the specified dimensions like this: var readSettings = new MagickReadSettings
{
BackgroundColor = MagickColors.Transparent,
FillColor = new MagickColor("#bebcbe"),
TextGravity = Gravity.Center,
FontFamily = "IFC RAILROAD", // Not sure if this is the correct font name
// Font = @"c:\path\font.ttf", // This might be an other option to specify the font.
Width = 200, // This should also be changed to the box that you now have.
Height = 100,
};
using var image = new MagickImage("label:MEMBER", readSettings); And after you have read the image you can use the |
Beta Was this translation helpful? Give feedback.
-
Hello, var readSettings = new MagickReadSettings()
{
BackgroundColor = MagickColors.Transparent,
FillColor = new MagickColor("#bebcbe"),
TextGravity = Gravity.Center,
FontPointsize = 200,
Font = @"IFC RAILROAD.ttf",
Width = 2000,
Height = 900
};
using var img = new MagickImage("base.png");
using var caption = new MagickImage("label:MEMBER", readSettings);
img.Composite(caption, 500, 400, CompositeOperator.Over);
img.Write("output.png"); but I still don't understand how I could automatically read every box inside the base image that consists of the light gray background in which the text should be written to. Could you tell me how to realize that? |
Beta Was this translation helpful? Give feedback.
Your first question is not easy to answer. It all depends on what else you want to do or which kinds of formats you want to support so I don't have an answer to that question. But using my library could be one of your options.
And if you use this library you can read an image with a label that fits in the specified dimensions like this: