Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. load gif image

load gif image

Scheduled Pinned Locked Moved C#
helpquestion
13 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A asma_panjabi

    hi, i am trying to load .gif image.As Image img1 = Image.FromFile(path); but it gives me OutOfMemoryException. can any one help me for this? Thanks :)

    modified on Friday, March 14, 2008 4:58 AM

    P Offline
    P Offline
    Parwej Ahamad
    wrote on last edited by
    #3

    The problem might be below mentioned point: * If image file is corrupted. * Bitmap.FromFile method on a file stream that is not finished writing to a file. * The image file does not have a valid image format or GDI+ does not support the pixel format of the file. * The program does not have permissions to access the image file. * The BackgroundImage propery is set directly from the Bitmap.FromFile method.

    Parwej Ahamad g.parwez@gmail.com

    A 2 Replies Last reply
    0
    • A asma_panjabi

      hi, i am trying to load .gif image.As Image img1 = Image.FromFile(path); but it gives me OutOfMemoryException. can any one help me for this? Thanks :)

      modified on Friday, March 14, 2008 4:58 AM

      L Offline
      L Offline
      leppie
      wrote on last edited by
      #4

      Dont dispose of the image (img1). This is a known issue.

      xacc.ide - now with IronScheme support
      IronScheme - 1.0 alpha 2 out now

      A 1 Reply Last reply
      0
      • A asma_panjabi

        hi, i am trying to load .gif image.As Image img1 = Image.FromFile(path); but it gives me OutOfMemoryException. can any one help me for this? Thanks :)

        modified on Friday, March 14, 2008 4:58 AM

        M Offline
        M Offline
        MuhammadFaisal
        wrote on last edited by
        #5

        Image img =image.FromFile(path); img.GetThumbnailImage(150, 150, new Image.GetThumbnailImageAbort(Nothing), IntPtr.Zero); Nothing will be a function which will return a bool like . private bool Nothing() { return true; }

        A 1 Reply Last reply
        0
        • M MuhammadFaisal

          Image img =image.FromFile(path); img.GetThumbnailImage(150, 150, new Image.GetThumbnailImageAbort(Nothing), IntPtr.Zero); Nothing will be a function which will return a bool like . private bool Nothing() { return true; }

          A Offline
          A Offline
          asma_panjabi
          wrote on last edited by
          #6

          m am working with C#.net 1.1 desktop application. As soon as Image img1 = Image.FromFile(iSelected); executes it throws an memoryexception

          1 Reply Last reply
          0
          • P Parwej Ahamad

            The problem might be below mentioned point: * If image file is corrupted. * Bitmap.FromFile method on a file stream that is not finished writing to a file. * The image file does not have a valid image format or GDI+ does not support the pixel format of the file. * The program does not have permissions to access the image file. * The BackgroundImage propery is set directly from the Bitmap.FromFile method.

            Parwej Ahamad g.parwez@gmail.com

            A Offline
            A Offline
            asma_panjabi
            wrote on last edited by
            #7

            1)file is'nt corrupted 2)No IO operations on File 3)Program has permissions on file

            1 Reply Last reply
            0
            • P Parwej Ahamad

              The problem might be below mentioned point: * If image file is corrupted. * Bitmap.FromFile method on a file stream that is not finished writing to a file. * The image file does not have a valid image format or GDI+ does not support the pixel format of the file. * The program does not have permissions to access the image file. * The BackgroundImage propery is set directly from the Bitmap.FromFile method.

              Parwej Ahamad g.parwez@gmail.com

              A Offline
              A Offline
              asma_panjabi
              wrote on last edited by
              #8

              The image file does not have a valid image format or GDI+ does not support the pixel format of the file.

              can u please explain me more about it?

              P 1 Reply Last reply
              0
              • A asma_panjabi

                The image file does not have a valid image format or GDI+ does not support the pixel format of the file.

                can u please explain me more about it?

                P Offline
                P Offline
                Parwej Ahamad
                wrote on last edited by
                #9

                Can catch the Error in Try Catch Block so can find the exact error message. Please verify once again your image file might be file is not correct format. explaon me also what you have done before loading the file

                Parwej Ahamad If you are hang on then you can send me mail g.parwez@gmail.com

                A 1 Reply Last reply
                0
                • P Parwej Ahamad

                  Can catch the Error in Try Catch Block so can find the exact error message. Please verify once again your image file might be file is not correct format. explaon me also what you have done before loading the file

                  Parwej Ahamad If you are hang on then you can send me mail g.parwez@gmail.com

                  A Offline
                  A Offline
                  asma_panjabi
                  wrote on last edited by
                  #10

                  thanks for replying it loads while viewing from external program.I am downloading this file from Ftpserver,saving it on my System's drive and then accessing it. I have given enough time for file to download. Unless the whole file is downloaded i dont proceed for Loading the image.

                  P 1 Reply Last reply
                  0
                  • A asma_panjabi

                    thanks for replying it loads while viewing from external program.I am downloading this file from Ftpserver,saving it on my System's drive and then accessing it. I have given enough time for file to download. Unless the whole file is downloaded i dont proceed for Loading the image.

                    P Offline
                    P Offline
                    Parwej Ahamad
                    wrote on last edited by
                    #11

                    Can post here code ? I think you have defined buffere size little bit maximum.

                    Parwej Ahamad If you are hang on then you can send me mail g.parwez@gmail.com

                    A 1 Reply Last reply
                    0
                    • P Parwej Ahamad

                      Can post here code ? I think you have defined buffere size little bit maximum.

                      Parwej Ahamad If you are hang on then you can send me mail g.parwez@gmail.com

                      A Offline
                      A Offline
                      asma_panjabi
                      wrote on last edited by
                      #12

                      no the buffer size is perfect for downloading

                      1 Reply Last reply
                      0
                      • L leppie

                        Dont dispose of the image (img1). This is a known issue.

                        xacc.ide - now with IronScheme support
                        IronScheme - 1.0 alpha 2 out now

                        A Offline
                        A Offline
                        asma_panjabi
                        wrote on last edited by
                        #13

                        Disposing or not disposing of the image object (img1) doesnt help. While using Bitmap img1 = new Bitmap(path, false); its throwing Invalid Parameter Used Exception.

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups