decodeImageLargest method

Image? decodeImageLargest(
  1. List<int> bytes
)

decodes the largest frame.

Implementation

Image? decodeImageLargest(List<int> bytes) {
  final info = startDecode(bytes);
  if (info == null) {
    return null;
  }
  var largestFrame = 0;
  var largestSize = 0;
  for (var i = 0; i < _icoInfo!.images!.length; i++) {
    final image = _icoInfo!.images![i];
    final size = image.width * image.height;
    if (size > largestSize) {
      largestSize = size;
      largestFrame = i;
    }
  }
  return decodeFrame(largestFrame);
}