Search

Atalasoft Knowledge Base

HOWTO: Open a Large Image Rescaled to Prevent Memory Exceptions

Administrator
DotImage

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)

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

Details
Last Modified: 5 Years Ago
Last Modified By: Administrator
Type: HOWTO
Article not rated yet.
Article has been viewed 807 times.
Options
Also In This Category