6

I have to load .tiff file

I did with both Image.FromFile() and Bitmap.FromFile()

But they are throwing OutOfMemoryException

Any solution for how to load this?

abatishchev
  • 98,240
  • 88
  • 296
  • 433
curiosity
  • 1,207
  • 5
  • 23
  • 34
  • 1
    It's possible the `OutOfMemoryException` is actually indicating an incompatible file format. But first, just how big is this TIFF file you're trying to load? Can you load a smaller one? – Cody Gray - on strike Nov 24 '10 at 10:04
  • can you publish the code you have? what is the size of the file you are attempting to load? – Jroc Nov 24 '10 at 10:05
  • The file is not maximum 19 MB.. and i m sure the file is not corrupted... it happens with .tiff extension alone.. any idea? – curiosity Nov 24 '10 at 10:06
  • 2
    Can you open the tiff in an image editor? It could be that the image is corrupt or incomplete. See this MS support article: http://support.microsoft.com/kb/810109 – Oded Nov 24 '10 at 10:09
  • If all else fails, you can try an external library instead of the functions built into the Framework. See here: http://stackoverflow.com/questions/2041783/using-libtiff-from-c-to-access-tiled-tiff-images – Cody Gray - on strike Nov 24 '10 at 10:26

4 Answers4

8

I assume that the TIFF file you are trying to load uses a compression that is not compatible with .Net. Namely the JPEG compression is not supported by .Net.

I suggest you try LibTiff.Net (though I cannot tell for sure if it will work):

user229044
  • 232,980
  • 40
  • 330
  • 338
Stefan Egli
  • 17,398
  • 3
  • 54
  • 75
1

I use ImageGlue. It can convert a lot more then just tiff.

user229044
  • 232,980
  • 40
  • 330
  • 338
Kimtho6
  • 6,154
  • 9
  • 40
  • 56
0

There is a possibility that this issue occurred due to multiple image tiff file. In this case, you have to extract individual image files from the source tiff file and then view those frame by frame. Here is a sample code.

http://www.c-sharpcorner.com/Blogs/10924/how-to-save-split-merge-and-view-multipage-tiff-image.aspx

anbuj
  • 499
  • 4
  • 15
0

There is a project on codeproject: "How to Load/Display images with C#". Take a look at it

RyuuGan
  • 762
  • 6
  • 11
  • That project appears to have difficulty loading TIFF files (see the comments), and certainly never mentions TIFF files explicitly in the article. – Cody Gray - on strike Nov 24 '10 at 10:10
  • 1
    -1 - The article has no information about the issue in the question and the OP already shows knowledge of what is mentioned in the article. – Oded Nov 24 '10 at 10:11