vintage / scratcher

Scratch card widget which temporarily hides content from user.
https://pub.dev/packages/scratcher
MIT License
572 stars 67 forks source link

Quality of the image is dropped significantly #20

Closed frankyvij closed 3 years ago

frankyvij commented 3 years ago

I spent over 3 hours correcting problems I may have with my image, but only to realize that quality of the image is dropped significantly by this widget itself.

I am using the latest 1.4.0 version. Let's keep the same quality of the image, can we?

frankyvij commented 3 years ago

I have changed the _loadImage implementation to below to meet my requirements.

Obviously this is not a generic solution, but it serves my app requirements well! 👍

  Future<ui.Image> _loadImage(String image) async {
    final data = await rootBundle.load(image);
    final list = Uint8List.view(data.buffer);
    final codec = await ui.instantiateImageCodec(list, allowUpscaling: true, targetWidth: 1080);
    final frame = await codec.getNextFrame();
    return frame.image;
  }
vintage commented 3 years ago

Mind to share repro example? I couldn't notice decreased image quality after applying into example project (https://github.com/vintage/scratcher/blob/master/example/lib/basic.dart#L61) following code:

image: Image.network("https://images.pexels.com/photos/853199/pexels-photo-853199.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=3000&w=6000")

vintage commented 3 years ago

I've quickly updated the example project so that it displays high-quality image (second tab). Let me know if you see there some glitches, maybe it's issue around device itself.

https://github.com/vintage/scratcher/tree/master/example

vintage commented 3 years ago

Closing due to inactivity. Feel free to reopen with additional informations.