Image.fromResized constructor

Image.fromResized(
  1. Image other, {
  2. required int width,
  3. required int height,
  4. bool noAnimation = false,
})

Implementation

Image.fromResized(Image other,
    {required int width, required int height, bool noAnimation = false})
    : _exif = other._exif?.clone(),
      iccProfile = other.iccProfile?.clone(),
      frameType = other.frameType,
      loopCount = other.loopCount,
      backgroundColor = other.backgroundColor?.clone(),
      frameDuration = other.frameDuration,
      frameIndex = other.frameIndex {
  _createImageData(
      width, height, other.format, other.numChannels, other.palette);

  if (other.extraChannels != null) {
    extraChannels = Map<String, ImageData>.from(other.extraChannels!);
  }
  if (other.textData != null) {
    textData = Map<String, String>.from(other.textData!);
  }
  frames.add(this);

  if (!noAnimation) {
    final numFrames = other.numFrames;
    for (var fi = 1; fi < numFrames; ++fi) {
      final frame = other.frames[fi];
      addFrame(Image.fromResized(frame, width: width, height: height));
    }
  }
}