A generic error occurred in GDI+ while assing tiff image file to Bitmap and Image

Hi,
I am getting "A generic error occurred in GDI+" error while reading the tiff image file to Bitmap or Image.
Below is my sample code.
string filePath=@"c:\Images\sample.tif";
Bitmap bmp=new Bitmap(filePath);   // here getting exception
int totalpages=bmp.GetFrameCount(.....);
etc......
I tried using Bitmap.FromFile() and also from FromStream() even for Image also but there is no use.
Moreover i m having full permissions for the file path and the tiff file is having multiple pages.
Can anyone help me to solve this issue please.
Thanks & Regards,
Kishore
Kishore

Make sure that the Tif file is valid (can other software open it)?  If you are able to save a Tif using GDI+, try saving that Tif, then opening it.  Part of me wonders if there is something about that specific Tif that GDI+ doesn't like.
You could also try using WIC to open the TIF, perhaps you would have better luck there.

Similar Messages

  • ExternalException was unhandled : A generic error occurred in GDI+.

    I am try to save this bitmap as jpg file for every 5 sec. It works fine at another application, before I move this method to another app. The error message shows ExternalException was unhandled : A generic error occurred in GDI+. I do not know if
    it is write permission issure or anything else. Since I use same computer and try to save at same file path, the error message keep going. I think I need help.
    The error code:
    public void captureScreen()
    bmpScreenshot = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    Debug.WriteLine("width:{0}, height:{1}", Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height);
    gfxScreenshot = Graphics.FromImage(bmpScreenshot);
    gfxScreenshot.CopyFromScreen(Screen.PrimaryScreen.Bounds.X, Screen.PrimaryScreen.Bounds.Y, 0, 0, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
    //Save the screenshot to the specified path that the user has chosen
    i++;
    string i1 = Convert.ToString(i);
    string name = "good" + i1 + ".jpg";
    ImageCodecInfo jpg = GetEncoder(ImageFormat.Jpeg);
    System.Drawing.Imaging.Encoder myEncoder = System.Drawing.Imaging.Encoder.Quality;
    EncoderParameters myEncoderParameters = new EncoderParameters(1);
    EncoderParameter myEncoderParameter = new EncoderParameter(myEncoder,
    50L);
    myEncoderParameters.Param[0] = myEncoderParameter;
    bmpScreenshot.Save(name, jpg,
    myEncoderParameters);
    Bitmap bitmap = new Bitmap(name);
    System.Drawing.Image image = (System.Drawing.Image)bitmap;
    The error shows here:
    bmpScreenshot.Save(name, jpg,
    myEncoderParameters);
    And Only alow me save one jpg, then pop up error

    Hi
    Since I can't reproduce your issue with some
    undefined code.
    Just take a look at from
    Graphics.FromImage Method
      in MSDN  document.
    You should always call the Dispose method to release the
    Graphics and related resources created by the
    FromImage method.  Please try and test it again.
    If still can't resolve, please post the complete code.  Thanks.
    Have a nice day!
    Kristin
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • SSRS 2012 SP2 - Windows 2008R2 - Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: A generic error occurred in GDI+

    Hi,
    I have built new SQL 2012 SSRS SP2 with Windows 2008R2 and BAR reports are not showing (just "x" mark in the left corner).
    Following is the log file information. I have gone through other forums and all are with windows 8 or windows 2012. Your help is much appreciated.
    library!ReportServer_0-15!d7c!08/13/2014-10:52:17:: i INFO: RenderForNewSession('/ProductionReporting/PlantProduction')
    reportrendering!ReportServer_0-15!d7c!08/13/2014-10:52:18:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: , Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: A generic error occurred
    in GDI+. ---> System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI+.
       at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
       at Microsoft.Reporting.Chart.WebForms.Chart.Save(Stream imageStream, ChartImageFormat format)
       at Microsoft.ReportingServices.OnDemandReportRendering.ChartMapper.GetImage(ImageType imageType)
       --- End of inner exception stack trace ---;
    Thanks,
    Vel
    Vel Thavasi

    Hi Vel,
    According to the error message, the issue is related to GDI+. Based on my research, it is a known issue that the GDI+ need to be updated on Windows Server 2008 R2. If we want to know what version of GDI+, we can do a file search for Gdiplus.dll.
    To fix this issue, please install the hotfix for your Windows Server 2008 R2 from the following kb:
    http://support.microsoft.com/kb/2495074
    There following thread about the similar issue is for your reference:
    http://social.msdn.microsoft.com/Forums/sqlserver/en-US/50c071db-b4fc-4a2e-a9f4-e10e833c97d2/report-not-rendering-charts-in-pdf-a-generic-error-occurred-in-gdi?forum=sqlreportingservices
    If there are any other questions, please let me know freely.
    Regards,
    Katherine Xiong
    Katherine Xiong
    TechNet Community Support

  • Report not rendering charts in pdf (A generic error occurred in GDI+)

    I've found the following exception stack trace in the Report Server log:
    ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: , Microsoft.ReportingServices.ReportProcessing.RenderingObjectModelException: A generic error occurred in GDI+. ---> System.Runtime.InteropServices.ExternalException:
    A generic error occurred in GDI+.
       at System.Drawing.Image.Save(Stream stream, ImageCodecInfo encoder, EncoderParameters encoderParams)
       at Microsoft.Reporting.Chart.WebForms.Chart.Save(Stream imageStream, ChartImageFormat format)
       at Microsoft.ReportingServices.OnDemandReportRendering.ChartMapper.GetImage(ImageType imageType)
       --- End of inner exception stack trace ---;
    I've got no idea what this is, any help would be appreciated. I don't know what could potentially cause this, so I don't even know how to start looking for a fix.
    Other info:
    SSRS 2012 BI
    Win Server 2008 R2 (Running on Hyper-V)
    The pdf report(s) renders and is saved to the location it is meant to, but devoid of any charts. A data driven subscription controls the rendering.

    Hi,
    This is a known issue with Windows GDI+. To resolve the issue, please install the hotfix for youR Windows Server 2008 R2 from:
    http://support.microsoft.com/kb/2495074
    Regards,
    Mike Yin
    TechNet Community Support

  • Bitmap.Save 'A generic error occurred in GDI+'

    Hello All,
    I was just going to play around by generating some bitmaps programatically.
    I started off with this simple example, expecting everything to go smoothly, but have run into a strange error.
    The following code is by no means good, just something simple and complete I would expect to work:
    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Text;
    using System.Windows.Forms;
    namespace BitmapOutput
        public partial class Form1 : Form
            /// <summary>
            /// The picture i am drawing
            /// </summary>
            System.Drawing.Bitmap myBitmap;
            /// <summary>
            /// Graphics object for drawing
            /// </summary>
            System.Drawing.Graphics myGrafx;
            public Form1()
                InitializeComponent();
                this.myBitmap = new Bitmap(800, 600);
                this.myGrafx =                 System.Drawing.Graphics.FromImage(this.myBitmap);
                this.DrawPicture();
                this.ShowPicture();
                this.SavePicture();
            public void DrawPicture()
                this.myGrafx.DrawEllipse(
                    new Pen(System.Drawing.Color.AliceBlue),                 new Rectangle(0, 0, 100, 100));
            public void ShowPicture()
                this.pictureBox1.Image = this.myBitmap;
            public void SavePicture()
                this.myBitmap.Save("Output\\out.bmp" ,                    System.Drawing.Imaging.ImageFormat.Bmp );
    This runs fine until the SavePicture(...) function is called.
    I get the exception:
    "A generic error occurred in GDI+."
    at the this.myBitmap.Save(...); line.
    Most likely there is some detail that I have overlooked, and I appreciate it if anyone could point out to me what I could do to fix it.
    But, I'd like to think that this code would work, it makes sense, and requires little effort, that should be one of the goals of .net
    Any help or ideas are greatly appreciated!
    P.S. how do I use 'code' tags?

    Actually, the fix is to properly dispose of your objects in order.  This is one advantage of C#, with the using() syntax:
    // new image with transparent Alpha layer
    using (var bitmap = new Bitmap(330, 18, PixelFormat.Format32bppArgb))
    using (var graphics = Graphics.FromImage(bitmap))
    // add some anti-aliasing
    graphics.SmoothingMode = SmoothingMode.AntiAlias;
    using (var font = new Font("Arial", 14.0f, GraphicsUnit.Pixel))
    using (var brush = new SolidBrush(Color.White))
    // draw it
    graphics.DrawString(user.Email, font, brush, 0, 0);
    // setup the response
    Response.Clear();
    Response.ContentType = "image/png";
    Response.BufferOutput = true;
    // write it to the output stream
    bitmap.Save(Response.OutputStream, ImageFormat.Png);
    Response.Flush();
    Notice how I dispose (end the using) of the graphics parameter, before I save it?  You don't have to use the using() statements, just call Dispose() at the end of the scope I show above.
    I ran into this problem today on Azure (works locally in the cloud, just an Azure 1.3 thing!), and I saw the link to the blog post above.  That was a good link, as it pointed me in the direction of disposing the graphics earlier.
    But, there is no point of increasing hte memory usage of two bitmaps if you dispose of your graphics properly before saving.
    http://eduncan911.com

  • "An error occurred accessing your Microsoft SharePoint Foundation site files" connecting site with SharePoint Designer

    I have a SharePoint 2013 environment with 1 AD Server, 1 DB Server and 1 APP Server, with 13 Web Applications running under the SharePoint.
    Recently I rebuilted the application because of some infrasctrucutre problems, and I was able to solve all of them, except one. I can't connect to any of those 13 Web Apps with SharePoint Designer. When I try to connect, it always ask credentials, then it
    seems like loading the site, then the error appears:
    "An error occurred accessing your Microsoft SharePoint Foundation site files. Authors - if you are authoring against
    a Web server, please contact the Webmaster for this server's Web site. WebMasters - please see the server's application event log for more details."
    I've spent hours troubleshooting it, but none of the information I found was valid. I've already tried to clean the cache, but didn't work. I found plenty of related data of this
    error with FrontPage and old versions of SharePoint, but nothing helped. All the Web Apps are SPD-Enabled at Site Collection Administration. I've tried connecting from many different PC's. The 15/LOGS folder doesn't get any data from this error, neither the
    Event Viewer.
    I really don't know what else to do. Please Help!

    I found the answer of my issue was in a .NET Agent installed by NewRelic on the server. I found a connection trouble with Fiddler, then I end up figuring this out:
    This can be the result of Real User Monitoring so the first step in troubleshooting would be to disable it and see how it affects the application. The .Net Agent injects snippets of javascript into the header of pages sent to the users browser to measure the
    page load time on the user's end.
    You can disable RUM by editing newrelic.config and changing this line:
    <browserMonitoring autoInstrument="true"/>
    to this:
    <browserMonitoring autoInstrument="false"/>

  • I am running Windows 7 (64bit) , and an error message appears following a recent update to iTunes v 11.1.2:  "iTunes could not connect to the iTunes store. An unknown error occured (-3212). Make sure your network connection is active and try again." help!

    I am running Windows 7 (64bit) , and an error message appears following a recent update to iTunes v 11.1.2:  "iTunes could not connect to the iTunes store. An unknown error occured (-3212). Make sure your network connection is active and try again." I have dug a little bit into possible problems but haven't found a solution yet, one note is that the network connection is OK. A response would be highly appreciated!  Thanks in advance.

    Hi c1r1g1,
    If you are having an issue connecting to the iTunes Store, you may find the following article helpful:
    Apple Support: Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Regards,
    - Brenden

  • Cannot sync my iphone to my itunes account on the computer.  I get the message: iTunes could not connect to the iTunes store  An unknown error occured (-3212).  Make sure your network connection is active and try again.

    I cannot sync my iphone to my itunes account on the computer.  I get the following message: " iTunes could not connect to the iTunes store.  An unknown error occured (-3212).  Make sure our network connection is active and try again."  Has anyone else had this problem?

    Did you find a resolution as I'm having same problem?

  • Upon sync or backup, I receive the message, "iTunes could not back up the iPhone "iPhone name" because and error occurred. I have deleted my backup file and tried another computer, with no success.  Also, the bluetooth function stopped working.

    Upon sync or backup, I receive the message, "iTunes could not back up the iPhone "iPhone name" because and error occurred. I have deleted my backup file and tried another computer, with no success.  Also, the bluetooth function stopped working.

    Hi, EJ13. 
    I see you are having issues with backing up you iPhone and have tried a couple troubleshooting steps.  There are a couple more steps I could recommend in the article below. 
    iOS: Troubleshooting backup issues in iTunes
    http://support.apple.com/kb/ts2529
    Regards,
    Jason H. 

  • An unexpected error occurred processing your request. Check the logs for details and correct the problem.

    Hi All,
    I am configuring RSS Viewer webpart to SP 2013. 
    But i am getting an error "An unexpected error occurred processing your request. Check the logs for details and correct the problem."
    I looked for solution of this error. i got to know, we need to set proxy server in web.config file.
    So, in order to resolve this i put the following set of code in web.config and save the file
    <system.net>
        <defaultProxy>
          <proxy usesystemdefault="True" proxyaddress="http://myproxyserver" bypassonlocal="True" />      
        </defaultProxy>
      </system.net>
    But, still i am getting the error. 
    What could be the problem now. 
    Any help is much appreciated. 
    Thanks,
    Rakesh

    Hi Rakesh,
    According to your description, my understanding is that you got an error when you used RSS viewer web part in SharePoint 2013.
    The RSS viewer web part uses authentication delegation and is using the current user's credentials to access the proxy. However, the RSS viewer only supports anonymous and Kerberos authentication. So if you are using NTLM authentication, the RSS viewer will
    not be able to authenticate the user through the proxy. More information, please refer to the link:
    http://kalsing.blogspot.com/2007/11/troubleshooting-rss-viewer-web-part.html
    Also see:
    http://blogs.technet.com/b/sharepointdse/archive/2007/04/13/fun-with-rss.aspx
    I hope this helps.
    Thanks,
    Wendy
    Wendy Li
    TechNet Community Support

  • An error occurred during the processing of a configuration file.

    hi,
    On installation and using oracle session provider, i am getting following error.
    An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.
    Line 51: <providers>
    Line 52: <add name="MyOracleSessionStateStore"
    Line 53: type="Oracle.Web.SessionState.OracleSessionStateStore,
    Line 54: Oracle.Web, Version=2.112.2.0, Culture=neutral,
    Line 55: PublicKeyToken=89b483f429c47342"
    Can any one help me?
    Thanks in advance
    Siva

    my server :
    os windown server 2003
    iis 6.0

  • An error occurred during the compilation of the requested file, or one of its dependencies.

    An error occurred during the compilation of the requested file, or one of its dependencies. The type or namespace name 'Directory Services' does not exist in the namespace 'System' (are you missing an assembly reference?) 

    Hello,
    What you are trying to achieve and where you are getting this error?
    If you facing issue with namespace then refer this link:
    http://stackoverflow.com/questions/265096/system-directoryservices-is-not-recognised-in-the-namespace-system
    http://stackoverflow.com/questions/10691001/the-type-or-namespace-name-directoryservices-does-not-exist-in-the-namespace
    Hemendra:Yesterday is just a memory,Tomorrow we may never see
    Please remember to mark the replies as answers if they help and unmark them if they provide no help

  • TS3297 Error message: 'Cant connect to the itunes store. An unknown error occured (-3212) please check you have an active internet connection and try again'. Help !

    Can someone help me please ? I was using itunes (downloading albums etc) just half an hour ago. I had a pop up asking me if i'd like to download the latest version of itunes, which i accepted. When the update had finshed downloading, i then restarted my computer, as i usually would. Tried to re access the itunes store, and received the following error message: 'Cant connect to the itunes store. An unknown error occurred (-3212) please check you have an active internet connection and try again.
    Needless to say, i have an active internet connection and cant see any reason why this would be happening, it has never happened before ?
    Any help would be appreciated.

    Do you have PeerBlock installed/    >  TS3297 Error message: 'Cant connect to the itunes store.

  • I received this error: "iTunes could not connect to the iTunes Store. An unknown error occurred (-3212). Make sure your network connection is active and try again." We are connected. Any ideas on how to solve this?

    I downloaded iTunes. I was going to put an MP3 lecture on iTunes so I could put it on our new iPad but I got the message:
    "iTunes could not connect to the iTunes store. An unknown error occurred (-3212). Make sure your network connection is active and try again." I was able to get on this site so I know the connection is fine. Any ideas how to fix this?
    Thanks.

    Hello Buck
    If you are having issues with the iTunes store, check out the article below.
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

  • "iTunes could not connect to the iTunes Store. An unknown error occurred (-3212). Make sue your network connection is active and try again." What can I do to fix it?

    Help! I'm getting the following error message:
    "iTunes could not connect to the iTunes Store. An unknown error occurred (-3212). Make sue your network connection is active and try again."
    I'm obviously connected to the internet since I'm typing this. What can I do to fix the problem? Thank you for your help!

    Hello Buck
    If you are having issues with the iTunes store, check out the article below.
    Can't connect to the iTunes Store
    http://support.apple.com/kb/ts1368
    Thanks for using Apple Support Communities.
    Regards,
    -Norm G.

Maybe you are looking for