User Guide > How to Work with... > Image Display > Display Images in WPF Environment > Performance Considerations |
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
or
DisplayWidth * DisplayHeight * 3 bytes
depending on image pixel format. Display buffer size does not depend significantly on the image size. In Native mode, ImageGear can display any image that it can load.
For displaying an image in WPF scaling mode, ImageGear allocates approximately
ImageWidth * ImageHeight
or
ImageWidth * ImageHeight * 3 bytes
depending on image pixel format. The larger the image is, the more memory that is required to display it in WPF mode. If the image is large enough, an attempt to display it in WPF scaling mode may result in an OutOfMemory exception.
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 8-bit per pixel bitmap. As a result, large bitonal images display successfully in Native scaling mode, but can't be precisely displayed in actual size in WPF scaling mode. As a result, huge bitonal images display fast in Native scaling mode, but may cause an exception in WPF scaling mode.