简体   繁体   中英

How Can I View Gigapixxel Images In flutter App

I am trying to view Gigapixxel image in flutter App.I want to Optimize the image size for reduce Data Usage and save the memory when open the image. User should be able to Zoom that image. How I can do that in Flutter? (I want to zoom Image as google map)

Use this dependency Flutter Native Image its easy to use and will do the job you are looking for. It will reduce the size of the image and for zooming in just use this dependency and wrap it up with any widget you want. Photo View

Simple Usage of photo view

 Container(
child: PhotoView(
  imageProvider: AssetImage("your asset"),
)
);

Flutter native image:

To crop

File croppedFile = await FlutterNativeImage.cropImage(file.path, originX, originY, width, height);

To compress image:

File compressedFile = await FlutterNativeImage.compressImage(file.path,
quality: quality, percentage: percentage);

You have to give it a file from the file system and optionally provide a quality (1-100) and a resizing percentage (1-100). Each platform will use it's proper tools to handle the resizing.

The documentation of each dependency is your friend have a look at it, read a bit and use the code according to your needs.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM