Jan 12 '10 at 18:12 I'm glad you're the only person on the planet that that happens to! :) –Jay Riggs Jan 12 '10 at 18:16 add a comment| src_rect = New Rectangle( 0, 0, src_img.Width, src_img.Height ) fin_rect = New Rectangle( 0, 0, image_width, image_height ) ' Create final image ... Public Shared Function CopyToStandaloneBitmap(ByRef InputImage As Image) As Image Dim memory As New MemoryStream() InputImage.Save(memory, Imaging.ImageFormat.Png) Return Image.FromStream(memory) End Function Public Shared Function InitializeStandaloneImageCopy(ByVal strPathFile As String) As Image If strPathFile To work around this use some simple code in an intermediate step (let's say 1a) that creates a new, blank Bitmap object with the same width/height/colordepth as the image you read. weblink
I corrected the folder's path but still it's giving the error. Common scenario that this happens: 1) Read an image into a Bitmap object 2) Manipulate the bitmap 3) Wanting to write back the bitmap to overwrite the original image file you And more importantly, if you see an obvious fix to the code, please reply!! My application needed an image to be loaded in a pic box and user will draw something on that and save back to file. http://stackoverflow.com/questions/2050996/saving-image-a-generic-error-occurred-in-gdi-vb-net
To avoid the lock, construct the image from a MemorySteam: MemoryStream ms = new MemoryStream(File.ReadAllBytes(fileName)); Image img = Image.FromStream(ms); "The improbable we do, the impossible just takes a little longer." (Steven Create them before saving image. How does this Makefile makes C program without even specifying a compiler? Directly to C: was the cause of the error for me - rights issue?
Insults are not welcome. You must keep the stream usable until the image can no longer be used. Privacy statement Dev Centers Windows Office More... But the primary bug is: Using MS As New System.IO.MemoryStream(BArray) The Using statement is incorrect, it makes the stream in-accessible.
Thanks for the help. The way to deal with that is to load a copy of the source image, instead of setting the Image property directly. Coding standard for clarity: comment every line of code? http://www.codeproject.com/Questions/672546/A-generic-error-occurred-in-GDIplus-VB-NET-WHILE-s The code below was compiled under v2.0 of the Framework and now whenever the code runs we receive the following: System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
Your Email This email is in use. Member 9377677 24-Oct-13 1:09am thanks griff its solved OriginalGriff 24-Oct-13 3:00am You're welcome! Here is the last few items on the stack trace... All times are GMT -5.
Your Email Password Forgot your password? http://www.dreamincode.net/forums/topic/256195-generic-error-occured-in-gdi/ dseven - Tuesday, October 11, 2011 5:35:28 AM Thanks, great post, I really facing this exception and after lot of googling I found this by some reference. Permalink Posted 15-Apr-14 13:32pm Member 10748748314 Updated 15-Apr-14 13:33pm Rate this: Please Sign up or sign in to vote. more stack exchange communities company blog Stack Exchange Inbox Reputation and Badges sign up log in tour help Tour Start here for a quick overview of the site Help Center Detailed
Is ((a + (b & 255)) & 255) the same as ((a + b) & 255)? Could a Universal Translator be used to decipher encryption? in Windows Application Exporting excel chart to PNG - a generic error occurred in GDI+ - VB.NET A generic error occurred in GDI+. http://meditationpc.com/generic-error/generic-errors.php Friday, February 08, 2013 10:41 AM Reply | Quote 0 Sign in to vote I might also depend on where your output is to.
share|improve this answer answered Jan 12 '10 at 18:12 Hans Passant 661k819751632 add a comment| up vote 1 down vote The Image puts a lock. Hope it help some one. 23 Comments Na, _one_ of the possible errors could be the one, you described. Noise in op amp design or EMI?
SunandaSh - Thursday, October 29, 2009 2:47:44 PM Hello: May anyone help on this? Don't forget to mark solution providing post as "Answered". Solution 2 Accept Solution Reject Solution I had the same problem, I solved it creating the path were I want to save and giving right access. I probably should've discovered it myself, but I am an API applications programmer, and it simply never occurred to me that it would be that easy!
To start viewing messages, select the forum that you want to visit from the selection below. Thanks! ========================================================== dim posted_fileobj as HttpPostedFile dim img_file_stream as FileStream dim src_img as System.Drawing.Bitmap dim fin_img as System.Drawing.Bitmap dim src_rect as Rectangle dim fin_rect as Rectangle dim gobj as Graphics glen.a Reply With Quote Jul 8th, 2011,03:05 PM #2 boops boops View Profile View Forum Posts PowerPoster Join Date Nov 2008 Location Holland/France Posts 2,855 Re: A generic error occurred in this content Search: Advanced Forum Search Forums Programming Web Development Computers Tutorials Snippets Dev Blogs Jobs Lounge Login Join!
A generic error occurred in GDI+ Error A generic error occurred in GDI+. Such this case: This is an extension method that converts a byte array to a bitmap, but using statement will dispose the memory stream, this will cause this error always: public Bizarre, but perfect. Forum New Posts FAQ Calendar Forum Actions Mark Forums Read Quick Links Today's Posts View Site Leaders What's New?
A generic error occurred in GDI+ Advertise | Privacy | Mobile Web01 | 2.8.161122.1 | Last Updated 5 Nov 2014 Copyright © CodeProject, 1999-2016 All Rights Reserved.