ImageGear for Silverlight
Performance Considerations
See Also Send Feedback
ImageGear for Silverlight User Guide > Using ImageGear for Silverlight > Displaying Images > Displaying Images in Silverlight Environment > Performance Considerations

Glossary Item Box

Because different approaches are used for image display, Native and WPF scaling modes differ in their capabilities and performance.

WPF scaling mode works significantly faster for small and medium sized images (where image size is comparable to screen size).

For larger images, WPF scaling mode requires more memory than Native scaling mode. For displaying an image in Native mode, ImageGear allocates approximately

DisplayWidth * DisplayHeight * 4 bytes + Max (DisplayWidth * DisplayHeight * RenderBytesPerChannel bytes, 4 Mb)

RenderBytesPerChannel is 1 for indexed and grayscale images, and 3 for other types of images.

In this case, the display buffer size does not depend significantly on the image size. In Native mode, ImageGear can display any image that it can load.

In WPF scaling mode, the amount of memory allocated for image display depends on the image size and on the ImGearWpfDisplayScaleSettings.RenderMedia Property. In general, the larger the image is, the more memory that is required to display it in WPF mode. However, if RenderMedia is ImGearRenderMedia.BitmapImage, and the rendered image size exceeds 16 megabytes, ImageGear renders it in reduced size, such that the rendered image size stays just within the 16 Megabyte size limit. Use Native scale mode or set the RenderMedia Property to ImGearRenderMedia.WriteableBitmap if you need to display large images in actual size.

If RenderMedia is ImGearRenderMedia.BitmapImage

If (ImageWidth * ImageHeight * RenderBytesPerChannel bytes < 16 Mb)

ImageGear allocates approximately

2 * ImageWidth * ImageHeight * RenderBytesPerChannel + ImageWidth * ImageHeight * 4 bytes

 Else

ImageGear allocates approximately

(2 + 4 / RenderBytesPerChannel) * 16 Mb

Else

ImageGear allocates approximately

ImageWidth * ImageHeight * 4 bytes + Max (ImageWidth * ImageHeight * RenderBytesPerChannel bytes, 4 Mb)

 

RenderBytesPerChannel is 1 for indexed and grayscale images, and 3 for other types of images.

The difference between scaling modes is especially important for large bitonal images. ImageGear uses Run Length encoding to store the bitonal DIBs, which typically requires less than one bit for storing each pixel. When displaying such an image in Native scaling mode, ImageGear also requires a relatively small buffer for display. On the other hand, in WPF scaling mode, ImageGear allocates a full size uncompressed 32 bit per pixel bitmap. As a result, huge bitonal images display fast in Native scaling mode, but will either display in reduced size or cause an out of memory exception in WPF scaling mode. 

See Also

©2013. Accusoft Corporation. All Rights Reserved.