简体   繁体   English

如何在 flutter 应用程序中查看 Gigapixxel 图像

[英]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.我正在尝试在 flutter 应用程序中查看 Gigapixxel 图像。我想优化图像大小以减少数据使用并在打开图像时保存 memory。 User should be able to Zoom that image.用户应该能够缩放该图像。 How I can do that in Flutter?我怎么能在 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.使用这个依赖Flutter Native Image它易于使用并且可以完成您正在寻找的工作。 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: Flutter 原生镜像:

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).您必须从文件系统中为其提供一个文件,并可选择提供质量 (1-100) 和调整大小百分比 (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.每个依赖项的文档是你的朋友看看它,阅读一下并根据你的需要使用代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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