Open huge Tiff Image

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • kunal pawar
    Contributor
    • Oct 2007
    • 297

    Open huge Tiff Image

    Hello,
    Can any body tell me load Tiff file having size around 600MB, using C# in windows application
  • tlhintoq
    Recognized Expert Specialist
    • Mar 2008
    • 3532

    #2
    I assume you've looked over the various methods and tips from a google search

    What have you done so far?
    Does your existing code work with small TIFF's but fail on the big one?
    What kind of errors are you getting when you open the large TIFF?

    Comment

    • kunal pawar
      Contributor
      • Oct 2007
      • 297

      #3
      I tried through following statement

      Bitmap picBitmap = new Bitmap(@"Locati on");


      but it gives error "Out Of Memory"

      I have to load Tiff file upto 500MB

      Please help me !!!

      Comment

      • vanc
        Recognized Expert New Member
        • Mar 2007
        • 211

        #4
        Add more memory, I guess!!!

        Comment

        • kunal pawar
          Contributor
          • Oct 2007
          • 297

          #5
          Can u tell me how i can add memory ?

          Comment

          • MrMancunian
            Recognized Expert Contributor
            • Jul 2008
            • 569

            #6
            Originally posted by kunal pawar
            Can u tell me how i can add memory ?
            Memory is hardware that you mount on your motherboard. You can buy it in a lot of computershops.. .

            Steven

            Comment

            • tlhintoq
              Recognized Expert Specialist
              • Mar 2008
              • 3532

              #7
              It is fair to point out that "Out of memory" is also the error you get if you try to open a graphic that is not ready to be opened, usually because it is opened in another program... maybe still being written etc.

              Also the line you are using:

              [CODE=c]Bitmap picBitmap = new Bitmap(@"Locati on");[/CODE]

              while simple, sucks. It holds the file open on the hard drive until you are done with the bitmap object and your program disposes of it.

              Make sure you copy the bitmap to a new bitmap object as soon as you can and dispose of the 'link' to the file. Otherwise your program is keeping the file open and even you won't be able to read it in a second time if you tried to for some reason.

              Code:
              Bitmap tempBitmap = new Bitmap(@"Location");
              Bitmap myBitmap = (Bitmap)tempBitmap.Clone();
              Or something similar has treated me well in the past.

              Of course this means that for a moment you will have 2 x 500meg objects in memory. So you need a lot of RAM for this project.

              Comment

              • tlhintoq
                Recognized Expert Specialist
                • Mar 2008
                • 3532

                #8
                Originally posted by kunal pawar
                I tried through following statement

                Bitmap picBitmap = new Bitmap(@"Locati on");


                but it gives error "Out Of Memory"

                I have to load Tiff file upto 500MB

                Please help me !!!
                What about the other questions?
                Does your code work with small TIFF files?
                If your code doesn't work with ANY files then there is no point trying to make it work with the big ones. If it does work with the small ones then you know the code is good, but that you need more memory for your PC.
                How much memory is in the PC?
                How much is available (not already in use by the O.S. & other programs?

                Comment

                • kunal pawar
                  Contributor
                  • Oct 2007
                  • 297

                  #9
                  Yes, my application can open small TIFF files.
                  But i guess u r not getting my point. Or it is not problem of my Hardware memory.
                  Coz my application is not getting crash.



                  Any body knows solution

                  Comment

                  • tlhintoq
                    Recognized Expert Specialist
                    • Mar 2008
                    • 3532

                    #10
                    Originally posted by kunal pawar
                    Yes, my application can open small TIFF files.
                    But i guess u r not getting my point. Or it is not problem of my Hardware memory.
                    Coz my application is not getting crash.



                    Any body knows solution

                    If it opens small TIFF files then your code is probably good.
                    If you get "out of memory" error when loading large files, then you are probably out of memory. Take your computer to a computer service center and pay to have more installed.

                    Comment

                    • balabaster
                      Recognized Expert Contributor
                      • Mar 2007
                      • 798

                      #11
                      My thought is do the same thing they did with the software they used to create the hi-res images of the Mona Lisa. Only open the bit that's visible in the viewing window... as the window is scrolled, open the bit that becomes visible...

                      I have to say though, I don't work with graphics on a day to day basis, so unfortunately I don't know exactly how you'd go about that... but it can't be too difficult.

                      Comment

                      • kunal pawar
                        Contributor
                        • Oct 2007
                        • 297

                        #12
                        sorry dear,
                        if it is problem due to my Hardware then that huge image should not open using any 3rd party component. But it does. 3rd party component can open my Tiff file.

                        Comment

                        • tlhintoq
                          Recognized Expert Specialist
                          • Mar 2008
                          • 3532

                          #13
                          Originally posted by kunal pawar
                          sorry dear,
                          if it is problem due to my Hardware then that huge image should not open using any 3rd party component. But it does. 3rd party component can open my Tiff file.

                          When you say "3rd party component" do you mean a component that plugs into Visual Studio? Or do you mean a different program, such as Photoshop?

                          There are lots of ways around the memory problem. For example Photoshop does its own virtual memory scheme of swapping out pages of memory for space on the hard drive. That's why it has setting for which drives are acceptable for temp files.

                          Just because another program handles the big TIF doesn't mean the other program is storing it all in memory. So you may have to do the same: Find a creative way around the problem.

                          Comment

                          • kunal pawar
                            Contributor
                            • Oct 2007
                            • 297

                            #14
                            3rd party mean, already developed OCX control.

                            Comment

                            Working...