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

Go Back  Xtreme .NET Talk > .NET > Windows Forms > Write Text into Jpeg image


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



Hello!

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);
newImage.Save("sample.jpg",System.Drawing.Imaging.ImageFormat.Jpeg);
}

Please give me reply asap. Thanks!

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

Hello!

I have found the answer by myself already.

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

changed to...

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

fm Softair
Reply With Quote
Reply

Bookmarks

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 04:51 AM
Read and Write from Text File Shaitan00 Directory / File IO / Registry 4 12-22-2003 02:55 AM
How can I write the text from a textbox in my database? Zion ASP.NET 7 12-14-2003 11:52 AM
Write image files to a dat file Beeftime Directory / File IO / Registry 0 11-05-2003 01:19 PM

Advertisement:







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.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
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..
subscribe