-1

I need to convert text into an image. Does anyone know if I can use the creative version of imageresizer.net to do this?

I have searched a lot but haven't found anything to confirm or deny imageresizer can do this.

Philip Pittle
  • 11,821
  • 8
  • 59
  • 123
Md. Parvez Alam
  • 4,326
  • 5
  • 48
  • 108

1 Answers1

1

Why use when you can do it with out-of-box? From https://stackoverflow.com/a/2070493/1224069:

 private Image DrawText(String text, Font font, Color textColor, Color backColor)
 {
    //first, create a dummy bitmap just to get a graphics object
    Image img = new Bitmap(1, 1);
    Graphics drawing = Graphics.FromImage(img);

    //measure the string to see how big the image needs to be
    SizeF textSize = drawing.MeasureString(text, font);

    //free up the dummy image and old graphics object
    img.Dispose();
    drawing.Dispose();

    //create a new image of the right size
    img = new Bitmap((int) textSize.Width, (int)textSize.Height);

    drawing = Graphics.FromImage(img);

    //paint the background
    drawing.Clear(backColor);

    //create a brush for the text
    Brush textBrush = new SolidBrush(textColor);

    drawing.DrawString(text, font, textBrush, 0, 0);

    drawing.Save();

    textBrush.Dispose();
    drawing.Dispose();

    return img;
}
Community
  • 1
  • 1
Philip Pittle
  • 11,821
  • 8
  • 59
  • 123