bluefireteam / photo_view

📸 Easy to use yet very customizable zoomable image widget for Flutter, Photo View provides a gesture sensitive zoomable widget. Photo View is largely used to show interacive images and other stuff such as SVG.
MIT License
1.91k stars 548 forks source link

[BUG] Zoom out the image will generate mosaic #284

Open Aoi-hosizora opened 4 years ago

Aoi-hosizora commented 4 years ago

Describe the bug

I zoom out an image that is in the disk. But If the photo is small, it will generate mosaic when zoom in to a larger size. And if the photo is large, it will be sharpened when zoom out to a smaller size. That is, the quality is low.

To Reproduce

There is my code:

PhotoViewGallery.builder(
  scrollPhysics: BouncingScrollPhysics(),
  backgroundDecoration: BoxDecoration(color: Colors.black),
  loadFailedChild: Center(
    child: Icon(Icons.broken_image),
  ),
  onPageChanged: _onPageChanged,
  pageController: _controller,
  itemCount: widget.images.length,
  builder: (BuildContext context, int index) => PhotoViewGalleryPageOptions(
    imageProvider: LocalOrNetworkImageProvider( // customer provider
      url: widget.images[index],
      file: () async {
        var url = widget.images[index];
        var path = await getDownloadItemPath(id: widget.id, categoryId: widget.categoryId);
        path = '$path/${url.split('/').last}';
        return File(path);
      },
    ),
    initialScale: PhotoViewComputedScale.contained,
    minScale: PhotoViewComputedScale.contained / 2,
    maxScale: PhotoViewComputedScale.covered * 2,
    heroAttributes: PhotoViewHeroAttributes(tag: widget.images[index]),
  ),
),

Screenshots

Image from PhotoViewGallery (small photo zoom in)

image

Image from system gallery (small photo zoom in)

image

Image from PhotoViewGallery (large photo zoom out)

image

Image from system gallery (large photo zoom out)

image

walkthehorizon commented 4 years ago

+1,Severe sawtooth,Serious distortion

renancaraujo commented 4 years ago

May be related to #140.