instantiateImageCodec function
Instantiates an image codec Codec object.
list
is the binary image data (e.g a PNG or GIF binary data).
The data can be for either static or animated images. The following image
formats are supported: JPEG, PNG, GIF, Animated GIF, WebP, Animated WebP, BMP, and WBMP
The decodedCacheRatioCap
is the default maximum multiple of the compressed
image size to cache when decoding animated image frames. For example,
setting this to 2.0
means that a 400KB GIF would be allowed at most to use
800KB of memory caching unessential decoded frames. Caching decoded frames
saves CPU but can result in out-of-memory crashes when decoding large (or
multiple) animated images. Note that GIFs are highly compressed, and it's
unlikely that a factor that low will be sufficient to cache all decoded
frames. The default value is 25.0
.
The returned future can complete with an error if the image decoding has failed.
Implementation
Future<Codec> instantiateImageCodec(Uint8List list, {
double decodedCacheRatioCap = double.infinity,
}) {
return _futurize(
(_Callback<Codec> callback) => _instantiateImageCodec(list, callback, null, decodedCacheRatioCap),
);
}