Windows Forms Topics include: windows forms, controls, components and designers

Enjoy an ad free experience by logging in. Not a member yet? Register.
Go Back  Xtreme .NET Talk > .NET > Windows Forms > Write Text into Jpeg image

Thread Tools Display Modes
Old 10-20-2003, 04:06 AM
softair softair is offline
Join Date: Oct 2003
Posts: 2
softair is on a distinguished road
Default Write Text into Jpeg image


Got an error for running the below coding "A Generic Error Occured in GDI+", what's wrong?

private void button2_Click(object sender, System.EventArgs e)
Image newImage = Image.FromFile("sample.jpg");
String drawString = "Sample Text";
Font drawFont = new Font("Arial", 16);
SolidBrush drawBrush = new SolidBrush(Color.Black);
float x = 150.0F;
float y = 50.0F;
StringFormat drawFormat = new StringFormat();
drawFormat.FormatFlags = StringFormatFlags.DirectionVertical;
Graphics g=Graphics.FromImage(newImage);
g.DrawString(drawString, drawFont, drawBrush, x, y, drawFormat);

Please give me reply asap. Thanks!

fm Softair
Reply With Quote
Old 10-20-2003, 04:14 AM
softair softair is offline
Join Date: Oct 2003
Posts: 2
softair is on a distinguished road


I have found the answer by myself already.


changed to...

newImage.Save("samplenew.jpg",System.Drawing.Imaging.ImageFormat.Jpeg) ;

fm Softair
Reply With Quote


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reize JPEG Image WITHOUT compresssing it?? joshuaand Graphics and Multimedia 8 11-22-2005 05:51 AM
Read and Write from Text File Shaitan00 Directory / File IO / Registry 4 12-22-2003 03:55 AM
How can I write the text from a textbox in my database? Zion ASP.NET 7 12-14-2003 12:52 PM
Write image files to a dat file Beeftime Directory / File IO / Registry 0 11-05-2003 02:19 PM


Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..