Text -> pic?

L

Lasse Edsvik

Hello

I was wondering if you guys could show me a short simple example how to get
a known text saved to file.jpg with a font and size?

Im using C#
TIA
/Lasse
 
S

Scott Allen

Hi Lasse:

You'll want to create a new Bitmap class from System.Drawing, and then
use a Graphics instance to draw into the Bitmap, which you can then
save.

This would look approximately like:

Bitmap drawing = new Bitmap(320, 200, PixelFormat.Format32bppArgb);
Graphics graphics = Graphics.FromImage(drawing);
graphics.DrawString("Hello" , font, brush, x, y);
drawing.Save("hello.jpg", ImageFormat.Jpeg);


And don't forget to Dispose both Graphics and Bitmap objects.

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

List fonts? 2
Return sql-variable? 2
Access Access DLookup Function – more than 1 criteria 0
How to use created class? 1
ping? 1
setting up SSL for e-commerce? 1
RRS Problem 8
how do to do this in asp.net? 2

Top