Skip to content

Trying to create text backgrounds like tiktok and instagram #1705

Answered by ericvaroto
ericvaroto asked this question in Help
Discussion options

You must be logged in to vote

After many attempts, I managed to generate the image identical to the command. Here's the C# code:

public static async Task GenerateCaptionOverImageAsync()
{
    // Generate the caption
    using var caption = new MagickImage("caption:Genuinely so nice and simple", new MagickReadSettings
    {
        Width = 200,
        Font = "DejaVu-Sans",
        BackgroundColor = MagickColors.None,
        TextUnderColor = MagickColors.White,
        TextGravity = Gravity.Center,
        FontPointsize = 30,
        FillColor = MagickColors.Black,
        StrokeColor = MagickColors.None,
    });

    caption.BorderColor = MagickColors.None;
    caption.Border(12);

    // Clone caption to create back…

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@ericvaroto
Comment options

Comment options

You must be logged in to vote
0 replies
Answer selected by ericvaroto
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
2 participants