Opening Tiff File Throws Out Of Memory Exception

  • Thread starter Thread starter sternr
  • Start date Start date
S

sternr

Hey,

When I try to run the following code:

System.Drawing.Image tiffImage = System.Drawing.Image.FromFile(@"C:
\Image.tiff");

I get an "Out Of Memory" Exception.

Does anybody know how can I overcome this problem?

Thanks ahead

--sternr
 
Hey,

When I try to run the following code:

System.Drawing.Image tiffImage = System.Drawing.Image.FromFile(@"C:
\Image.tiff");

I get an "Out Of Memory" Exception.

Does anybody know how can I overcome this problem?

Thanks ahead

--sternr

Image.FromFile also throws an OutOfMemory exception when the image is
corrupted in some form or other errors occur, so you might want to
make sure that the file is a valid tiff, accessible and so on.

Sincerely,
Kevin Wienhold
 
KWienhold said:
Image.FromFile also throws an OutOfMemory exception when the image is
corrupted in some form or other errors occur, so you might want to
make sure that the file is a valid tiff, accessible and so on.

Sincerely,
Kevin Wienhold

Also the format of the TIFF file might simply be unsupported. There are
some pretty unusual formats, you can for example create a TIFF image
that uses JPEG compression...
 
Image.FromFile also throws an OutOfMemory exception when the image is
corrupted in some form or other errors occur, so you might want to
make sure that the file is a valid tiff, accessible and so on.

I've seen this as well: a corrupted tiff causes an
OutOfMemoryException. The only solution I've found is to catch the
exception for that call and treat it as though the image were
corrupted.
 
Thanks for all your responses!
I'm afraid I cannot post the tiff since it has value to my company...
The tiff's size is 90kb and I don't think the image is corrupted as I
can open it using Microsoft Imaging Preview.

I thought maybe the tiff is compressed using a compression
algorithm .Net does not support, but I could not find any
documentation for getting such info.

Any ideas?

Thanks ahead

--sternr

sternr,

Can you post the tiff? How large is it on disk?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




When I try to run the following code:
System.Drawing.Image tiffImage = System.Drawing.Image.FromFile(@"C:
\Image.tiff");
I get an "Out Of Memory" Exception.
Does anybody know how can I overcome this problem?
Thanks ahead
--sternr- Hide quoted text -

- Show quoted text -
 
I had a similar problem when working for a scanner company and using .net
1.1

In fact, I had JPEG within TIFF. As of .NET 1.1, this was not a supported
format and I got an out of memory exception.
I just did not find anyway to read it using the standard .net component. I
had to use a specialized one (e.g.: Pegasus).

- José

sternr said:
Thanks for all your responses!
I'm afraid I cannot post the tiff since it has value to my company...
The tiff's size is 90kb and I don't think the image is corrupted as I
can open it using Microsoft Imaging Preview.

I thought maybe the tiff is compressed using a compression
algorithm .Net does not support, but I could not find any
documentation for getting such info.

Any ideas?

Thanks ahead

--sternr

sternr,

Can you post the tiff? How large is it on disk?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




When I try to run the following code:
System.Drawing.Image tiffImage = System.Drawing.Image.FromFile(@"C:
\Image.tiff");
I get an "Out Of Memory" Exception.
Does anybody know how can I overcome this problem?
Thanks ahead
--sternr- Hide quoted text -

- Show quoted text -
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top