I'm working on a project that captures a screenshot of a widget and saves it in gallery. my problem is there is few save to gallery packages in flutter and I tries almost all of them! they save images as jpg which adds extra black bars around my widget which I don't want them to be there. is there any package to save images to gallery in PNG format?
CodePudding user response:
You can save image to gallery by using Image_gallery_saver plugin.image_gallery_saver . For the black bars , you have to make sure that the screenshot is attached to the widget , what you want it image.
await ImageGallerySaver.saveImage(uint8list blob);
CodePudding user response:
I've found the solution after 2 days of struggling with that. you should save file as PNG to device path then use image_gallery_saver package to save it as file
File('$dir/file_name${DateTime.now()}.png').writeAsBytes(pngBytes!);
final result = await ImageGallerySaver.saveFile(imagePath);
