Click or drag to resize

IImageStreamSourceGetImageStream Method

Returns an object that contains information about the stream that contains the requested image. When you call this, the ImageStream member of the returned object will be open and the caller is responsible for closing it.

Namespace:  Atalasoft.Imaging.ImageSources
Assembly:  Atalasoft.dotImage (in Atalasoft.dotImage.dll) Version: 11.4.0.9.0.377 (.NET 4.5.2, x86)
Syntax
ImageSourceStreamInfo GetImageStream(
	int index
)

Parameters

index
Type: SystemInt32
The index of the image within the ImageSource.

Return Value

Type: ImageSourceStreamInfo
An object that contains the stream and information for finding the requested image within it.
Examples
Requesting a Stream from an ImageSource (C#)
public Size GetSize(RandomAccessImageSource src, int index)
{
    if (src is IImageStreamSource)
    {
       ImageSourceStreamInfo info = ((IImageStreamSource)src).GetImageStream(index);
       // caller is responsible for disposing info.ImageStream
       using (Stream s = info.ImageStream)
       {
          // reads size from meta-data, doesn't decode image
          return RegisteredDecoders.GetImageInfo(s, info.Frame).Size;            
       }
    } else {
        return src[index].Size; // reads the whole image into memory
    }
}
See Also