saadman
saadman

Reputation: 21

Flutter Image Picker Transparency

I have an app where users are supposed to be able to upload images with transparency (PNG's). I'm using the image picker package to achieve this:

  void selectGraphic() async {
    _graphic = await pickImageFile();
    if (graphic != null) {
      setState(() {});
    }
  }

In the code above, pickImageFile() calls this function:

Future<File?> pickImageFile() async {
  final XFile? pickedImage =
      await ImagePicker().pickImage(source: ImageSource.gallery);
  File? imageFile = (pickedImage != null) ? File(pickedImage.path) : null;
  return imageFile;
}

It works perfectly on Android, but iOS won't budge. Any images selected via iOS come up with a white background. This is despite the images being clearly transparent when viewed in the camera roll. This thread led me to this outdated package which led me to the wechat_assets_picker. That last package isn't solving my problem. While it shows the transparent image in the wechat preview, the images still have a white background once they are selected and displayed on the app.

Does anyone know what's going on and how to keep transparent images transparent? Thanks.

Upvotes: 0

Views: 35

Answers (0)

Related Questions