hnvn / flutter_image_cropper

A Flutter plugin for Android and iOS supports cropping images
969 stars 375 forks source link

[Flutter web] cropping png image with transparency as jpeg image with no transparency #450

Open opheliagame opened 7 months ago

opheliagame commented 7 months ago

I am trying to crop a transparent image and save it as a jpeg file with no transparency.

My settings look like this

 CroppedFile? croppedImage = await ImageCropper().cropImage(
      sourcePath: imageFile.path,
      compressFormat: ImageCompressFormat.jpg,
      compressQuality: 100,
      uiSettings: [
        AndroidUiSettings(
            toolbarTitle: 'Cropper',
            toolbarColor: Colors.deepOrange,
            toolbarWidgetColor: Colors.white,
            initAspectRatio: CropAspectRatioPreset.original,
            lockAspectRatio: false),
        IOSUiSettings(
          title: 'Cropper',
        ),
        WebUiSettings(
            context: context,
            presentStyle: CropperPresentStyle.dialog,
            boundary: CroppieBoundary(
              width: 300,
              height: 250,
            ),
            viewPort: const CroppieViewPort(width: 250, height: 250, type: 'circle'),
            enableExif: true,
            enableZoom: true,
            showZoomer: true,

      ],
    );

So my understanding is that when cropping a png file with transparency the croppedImage should be a jpeg but I am getting back a png. I have checked the mimetype of the returned Uint8List with the mimetype package

Is there something I am doing wrong?