473,387 Members | 1,700 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.

How to load multipage tiff file and display each of the images in a picturebox so as

1
I used the following code:
Expand|Select|Wrap|Line Numbers
  1. Image im = Image.FromFile(opendialog1.fileName);
  2.         IList images = new ArrayList();
  3.         int count
  4. =im.GetFrameCount(FrameDimension.Page);
  5.       for(int i=0; i < count; i++)
  6. {
  7.  
  8.     im.SelectActiveFrame(FrameDimension.Page, i);
  9.     MemoryStream m = new MemoryStream();
  10.     im.Save(m, ImageFormat.Bmp); 
  11.     images.Add( Image.FromStream(m));
  12.    // m.SetLength(0);
  13.   // m = null;
  14.    m.Close();
  15.    im.Dispose();
  16. }
  17.         for(int im=0;im<count;im++)
  18.         {
  19.             pictureBox1.Image = (Bitmap)images[0];
  20.         }
  21.  
  22.         images.Clear();
but it is giving me error :"out of memory "at the line
Image im = Image.FromFile(opendialog1.fileName);
Can anyone help me out from this problem?Is there any other way to accomplish my task?
Thanks in advance1
Jan 7 '15 #1
1 5002
Out of memory errors when using Image.FromFile() can happen for a variety of reasons.

First, there's the obvious reason of trying to load a huge image file such as TIFF with many pages. If your images are huge, it might not be a good idea to use the System.Drawing.Image class because it's not designed for such images. In that case, you're better off using a dedicated imaging library such as Leadtools or LibTIFF.

If it's not caused by huge images you can find some possible reasons, like running out of handles, in this discussion thread:
http://stackoverflow.com/questions/1...image-fromfile
Mar 12 '15 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

3
by: Al | last post by:
Is it possible, using only VB.NET code, to extract a single page from a multipage tiff file?
14
by: C.K | last post by:
How do I load an image file , e.g. C:\images\img1.jpg into a PictureBox, but in code ? Tia C.K
0
by: Will Arrowsmith | last post by:
Hi All, I am trying to create a .tiff file to fax using the windows fax service FAXCOMLib. I have created an array of images (bitmaps) and converted them to 1pbb format in order to allow...
2
by: Becker | last post by:
I have a two page TIFF document. I simply want to create an array of image and put the two pages of this multipage tiff in this array for some further processing on seperate "images." The...
0
by: munish | last post by:
Hi, I am trying to send a tiff file which contains multiple pages/frames as a dime attachment. When I am saving the file on the server only the first page of image gets saved. Any Ideasv how to...
2
by: Bdog | last post by:
I've been searching for the file PrintFramework.zip that I've seen linked on tons of posts but all the links are bad. Does anynone know where I can get a copy of this code, I hoping it is what I...
2
by: johnb41 | last post by:
In my app, I need to open up a multipage tiff file, and also display it's thumbnail images IN HIGH QUALITY. (High Quality meaning anti-aliased, and looking good; not rough and pixely) The...
0
by: Luke | last post by:
I have a big (500+ MB) multipage TIFF image file and a database file which contains index to each image in the TIFF file. The scheme of the database is very simple. imagename (text) byte...
0
by: Luke | last post by:
I have a big (500+ MB) multipage TIFF image file and a database file which contains index to each image in the TIFF file. The scheme of the database is very simple. imagename (text) byte...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: 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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.