flutter_image_editor icon indicating copy to clipboard operation
flutter_image_editor copied to clipboard

is GIF crop supported ?

Open Nico3652 opened this issue 3 years ago • 0 comments

Hi there,

The crop is working great for .jpg or .png but I'm not able to crop an animated GIF with this method :

 Future<Uint8List?> cropImageDataWithNativeLibrary(
      ExtendedImageEditorState? state) async {
    final Rect? cropRect = state!.getCropRect();
    final EditActionDetails? action = state.editAction;

    Uint8List? result;

    if (action != null) {
      final int rotateAngle = action.rotateAngle.toInt();
      final bool flipHorizontal = action.flipY;
      final bool flipVertical = action.flipX;
      final Uint8List img = state.rawImageData;

      final ImageEditorOption option = ImageEditorOption();
     
      if (action.needCrop && cropRect != null) {
        option.addOption(ClipOption.fromRect(cropRect));
      }


      if (action.needFlip) {
        option.addOption(
            FlipOption(horizontal: flipHorizontal, vertical: flipVertical));
      }

    
      if (action.hasRotateAngle) {
        option.addOption(RotateOption(rotateAngle));
      }

     
      result = await ImageEditor.editImage(
        image: img,
        imageEditorOption: option,
      );
    }
    return result;
  }

Is the GIF crop is supported ? I also tried editImageAndGetFile() but get no result.

How can this be done ? Thanks for help

Nico3652 avatar Aug 17 '22 14:08 Nico3652