?
Solved

how to convert text to image in c#

Posted on 2011-03-12
3
Medium Priority
?
344 Views
Last Modified: 2013-12-17
I need to convert a string text to image (eg:gif), rotate the image (90 or 270 degrees, etc) and save it to disk. Does anyone can help me? Sample code in C#?
Tks in advance
Leonel
0
Comment
Question by:leorocha
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
Kusala Wijayasena earned 2000 total points
ID: 35117004
Try this:

string text = "Hello World";

Bitmap objBitmap = new Bitmap(200, 200);
Graphics objGraphics = Graphics.FromImage(objBitmap);

Font objFont = new Font("Arial", 16f);

SolidBrush objBrushForeColor = new SolidBrush(Color.Black);
SolidBrush objBrushBackColor = new SolidBrush(Color.White);

objGraphics.FillRectangle(objBrushBackColor, 0, 0, Width, Height);
objGraphics.RotateTransform(45f); //Rotate Text

objGraphics.DrawString(text, objFont, objBrushForeColor, 40f, 10f);

objBitmap.Save("test.gif", ImageFormat.Gif);

Open in new window


-Kusala
0
 

Author Comment

by:leorocha
ID: 35117302
need this?:
using System.Drawing;
using System.Drawing.Imaging;
0
 
LVL 11

Expert Comment

by:Kusala Wijayasena
ID: 35117320
yes

-Kusala
0

Featured Post

Python: Series & Data Frames With Pandas

Learn the basics of Python’s pandas library of series & data frames and how we can use these tools for data manipulation.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
The article shows the basic steps of integrating an HTML theme template into an ASP.NET MVC project
In this video we outline the Physical Segments view of NetCrunch network monitor. By following this brief how-to video, you will be able to learn how NetCrunch visualizes your network, how granular is the information collected, as well as where to f…
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question