Reputation: 83
I need to generate thumbnails of "huge" image files without loading the full image in memory. This feature is perfectly implemented in WPF's BitmapImage.DecodePixelWidth / Height but i need to use it in a non-managed C++ dll.
I "think" it is implemented using WIC, however i cannot find any useful sample about this functionality, i would load all the thumbnail formats that WIC can handle.
Anyone can help about it?
Upvotes: 0
Views: 299
Reputation: 1506
Two of the WIC codecs (JPEG and JPEG-XR) support scaling within the decoder, and you can verify this at runtime using IWICBitmapSourceTransform::GetClosestSize
. However, even if the source image must be decoded at its full resolution, IWICBitmapScaler
will use minimal memory when scaling the image to its desired size, as indicated in the documentation's remarks.
Better still, IWICBitmapScaler
will automatically use the IWICBitmapSourceTransform
capability of the decoder when supported, so you can simply use it and get the behavior you seek automatically.
Upvotes: 1