Home : Open a Large Image Rescaled to Prevent Memory Exceptions
Q10256 - HOWTO: Open a Large Image Rescaled to Prevent Memory Exceptions

Opening a particularly large single frame image can push the boundaries of your computer’s memory.  Even if the large image fits into memory the first time, if it is necessary to do any additional processing on the image, DotImage may not be able to fit a copy or temporary image in memory to complete the task. If there are no concerns about losing a percentage of the pixels, the ReadScaled() method can open the image resampled from the TiffDecoder or JpegDecoder class. It takes a factor of the total size and produces the image at that size. The following code opens an image at 75% of its total size:

C#

TiffDecoder tiff = new TiffDecoder();

AtalaImage img = tiff.ReadScaled(myStream,frameIndex,.75,null);

VB.NET

Dim tiff As New TiffDecoder()

Dim img As AtalaImage = tiff.ReadScaled(myStream, frameIndex, 0.75, Nothing)

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.

Powered By InstantKB.NET v1.3
Copyright © 2002, 2019. InstantASP Ltd. All Rights Reserved