6
votes

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?

4
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
can you publish the code you have? what is the size of the file you are attempting to load? - Jroc
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
Can you open the tiff in an image editor? It could be that the image is corrupt or incomplete. See this MS support article: support.microsoft.com/kb/810109 - Oded
If all else fails, you can try an external library instead of the functions built into the Framework. See here: stackoverflow.com/questions/2041783/… - Cody Gray

4 Answers

8
votes

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):

1
votes

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

0
votes

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

0
votes

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