convertToRGBA static method

Image convertToRGBA(
  1. Image image
)

Implementation

static Image convertToRGBA(Image image) {
  final size = image.width;
  final resultImage = Image(width: size, height: size, numChannels: 4, palette: image.palette);

  for (int y = 0; y < size; y++) {
    for (int x = 0; x < size; x++) {
      final pixel = image.getPixel(x, y);
      resultImage.setPixel(x, y, ColorInt16.rgba(pixel.r.toInt(), pixel.g.toInt(), pixel.b.toInt(), pixel.a.toInt()));
    }
  }
  return resultImage;
}