473,387 Members | 1,464 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Opening Tiff File Throws Out Of Memory Exception

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

May 31 '07 #1
6 6623
sternr,

Can you post the tiff? How large is it on disk?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"sternr" <St****@gmail.comwrote in message
news:11**********************@u30g2000hsc.googlegr oups.com...
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
May 31 '07 #2
On 31 Mai, 14:34, sternr <Ste...@gmail.comwrote:
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

May 31 '07 #3
KWienhold wrote:
On 31 Mai, 14:34, sternr <Ste...@gmail.comwrote:
>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
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...

--
Göran Andersson
_____
http://www.guffa.com
May 31 '07 #4
On May 31, 8:01 am, KWienhold <hedov...@trashmail.netwrote:
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.

May 31 '07 #5
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

On May 31, 4:17 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
sternr,

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

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"sternr" <Ste...@gmail.comwrote in message

news:11**********************@u30g2000hsc.googlegr oups.com...
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- Hide quoted text -

- Show quoted text -

Jun 3 '07 #6
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" <St****@gmail.coma écrit dans le message de news:
11**********************@o5g2000hsb.googlegroups.c om...
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

On May 31, 4:17 pm, "Nicholas Paldino [.NET/C# MVP]"
<m...@spam.guard.caspershouse.comwrote:
>sternr,

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

--
- Nicholas Paldino [.NET/C# MVP]
- m...@spam.guard.caspershouse.com

"sternr" <Ste...@gmail.comwrote in message

news:11**********************@u30g2000hsc.googleg roups.com...
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- Hide quoted text -

- Show quoted text -


Jun 3 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Scott Brady Drummonds | last post by:
Hello, all, My most recent assignment has me working on a medium- to large-sized Windows-based C++ software project. My background is entirely on UNIX systems, where it appears that most of my...
1
by: ramsin.savra | last post by:
Hi, I'm using same code for opening a TIFF file in VC++ works just fine but under linux it says unable to open the tiff file! Any comment on this? if (argc < 2) { cout << "Not enough...
0
by: whornak | last post by:
I am attempting to open a TIFF using Image.FromFile and keep getting the 'System.OutOfMemoryException' error. Help suggests that: "If the file does not have a valid image format or if GDI+ does...
6
by: Phil | last post by:
Hi I have an issue when trying to stream blob image data from a SQL table to a .aspx page. the code I have works for GIF and JPEG but the images can be multiple pages and we would like them to open...
3
by: T. Davis | last post by:
In C#, I am able to successfully stream a TIFF image that comes from a BLOB field in a database, save it to file, then convert the pages within TIFF file into jpegs (using GDI+) and display on the...
5
by: Shane Story | last post by:
I can seem to get the dimensions of a frame in a multiframe tiff. After selecting activeframe, the Width/Height is still really much larger than the page's actual dimensions. When I split a...
7
by: Ben | last post by:
Hi We are looking for a component that offers that offers the below for Tiff files: Image clean-up (deskew, despeckle) Printing capabilities from VB The ability to add text to image, e.g....
10
by: =?Utf-8?B?UmludSBHb3BhbGFrcmlzaG5hIFBpbGxhaQ==?= | last post by:
Hi, Please help me to write a dll in C# , that will read each pages of a tiff image from a file and a memory stream object ( need two ways) and creatre a new tiff image object.The dll should...
3
by: =?Utf-8?B?UGhpbCBKb2huc29u?= | last post by:
Hi, I am using dotnet remoting with a binarry formatter. I have a property that returns a memorystream that has had a file loaded into it. When I try to access this property though I get an...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.