General GDI+ Error

Please support our C# advertiser: $4.95 a Month - ASP.NET Web Hosting – Click Here!
Reply

Join Date: Jan 2008
Posts: 27
Reputation: Barbarrosa is an unknown quantity at this point 
Solved Threads: 0
Barbarrosa Barbarrosa is offline Offline
Light Poster

General GDI+ Error

 
0
  #1
Mar 27th, 2008
Hello,
I am getting a General GDI+ Error according to the Visual C# debugger. i have no idea as to how to handle this problem. I have a button which i click and a section of the screen is cut and put into a bitmap. This is converted into tiff format which is sent for OCR using MODI. The first time I click the button it works, however, when i click the button again, I get a the error. Here is the line it is being pointed to:

bitonalBitmap.Save(@"c:\Bitonal-Out.tif", imageCodecInfo, encoderParameters);

Can anyone help me please.
Thanks in advance.
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 27
Reputation: Barbarrosa is an unknown quantity at this point 
Solved Threads: 0
Barbarrosa Barbarrosa is offline Offline
Light Poster

Re: General GDI+ Error

 
0
  #2
Mar 28th, 2008
I added a
try
{
code
}
catch...
Im finding that every second time I click the button, it works... if that helps anyone to understand this better...
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 7
Reputation: Reinard is an unknown quantity at this point 
Solved Threads: 1
Reinard Reinard is offline Offline
Newbie Poster

Re: General GDI+ Error

 
0
  #3
Mar 31st, 2008
First, have u got any more information on the type of exception you are getting? and what exactly is the error message?
Reply With Quote Quick reply to this message  
Join Date: Jan 2008
Posts: 27
Reputation: Barbarrosa is an unknown quantity at this point 
Solved Threads: 0
Barbarrosa Barbarrosa is offline Offline
Light Poster

Re: General GDI+ Error

 
0
  #4
Mar 31st, 2008
Sorry, should have posted that as well...

See the end of this message for details on invoking
just-in-time (JIT) debugging instead of this dialog box.

************** Exception Text **************
System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
at System.Drawing.Image.Save(String filename, ImageCodecInfo encoder, EncoderParameters encoderParams)
at BitonalConverter.Form1.OCRProcess(Int32 StartX, Int32 StartY, Int32 EndX, Int32 EndY, String file) in C:\Documents and Settings\user\Desktop\Bitonal\BitonalImageConverter_src\Bitonal\Bitonal.cs:line 58
at BitonalConverter.Form1.Process_Click(Object sender, EventArgs e) in C:\Documents and Settings\user\Desktop\Bitonal\BitonalImageConverter_src\Bitonal\Bitonal.cs:line 111
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Maybe this will help... I tried to delete the Bitmap after and was getting a "File used in another process error" which i also posted on another thread
Reply With Quote Quick reply to this message  
Join Date: Mar 2008
Posts: 7
Reputation: Reinard is an unknown quantity at this point 
Solved Threads: 1
Reinard Reinard is offline Offline
Newbie Poster

Re: General GDI+ Error

 
0
  #5
Apr 1st, 2008
Do you dispose of all your resources after the 1st button click? Do you specify a filename or is it a static filename you are using? sorry for all the questions im trying to determine more or less what may be the cause of this exception
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 1
Reputation: anooprawat2 is an unknown quantity at this point 
Solved Threads: 0
anooprawat2 anooprawat2 is offline Offline
Newbie Poster

Re: General GDI+ Error

 
0
  #6
Aug 25th, 2008
Originally Posted by Reinard View Post
Do you dispose of all your resources after the 1st button click? Do you specify a filename or is it a static filename you are using? sorry for all the questions im trying to determine more or less what may be the cause of this exception
Yes we do same as you mentioned.
Please reply me for the solution.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the C# Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC