搜索插件、代码仓与 APP 分类

插件详情v0.8.0

native_exif

一个用于读取和写入图像 EXIF 数据的插件。

AndroidiOS
近 30 天下载
5.5万
喜欢数
50
Pub 分数
150

安装插件

flutter pub add native_exif

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

NativeExif 是一个 Flutter 插件,可在 Android 和 iOS 上读取和写入图像的 EXIF 元数据。它提供原生级别的接口,用于访问 GPS 坐标、相机设置、时间戳等图像属性。该插件专为需要操作或提取详细图像信息而无需依赖第三方库的开发者设计。它与 Flutter 的资源和文件处理系统无缝集成,确保跨平台的高效性能和兼容性。

适合场景

  • 读取图像元数据以进行地理标记
  • 编辑EXIF数据以用于照片管理应用
  • 在图像共享功能中保留相机细节
  • 自动化照片处理工作流程
  • 与摄影或档案应用程序集成

主要特点

  • 支持读取和写入EXIF数据
  • 跨平台兼容性(Android 和 iOS)
  • 轻便高效
  • 与 Flutter 资源和文件的直接集成
  • 无外部依赖

适合对象

  • 摄影应用开发者
  • 图像元数据工具
  • 照片编辑工具
  • 归档和文档软件
  • 需要处理地理标记图像的应用程序

使用建议

  • 需要适当的文件访问权限
  • 仅限带有 EXIF 标签的图像文件
  • 可能不支持所有设备上的所有 EXIF 字段
  • 依赖于原生平台实现
  • 不适用于非图像文件类型

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

native_exif

A simple EXIF metadata reader/writer for Flutter using native functions from iOS and Android.

Usage

First create a EXIF reader instance by reading out an image path:

final exif = await Exif.fromPath(pickedFile!.path);
Reading attributes

Now you can run either pre-defined functions or get all attributes:

final originalDate = await exif.getOriginalDate();
final latLong = await exif.getLatLong();
final attribute = await exif.getAttribute("key");
final attributes = await exif.getAttributes();
Writing attributes

It is possible to write raw EXIF data of type String to specific EXIF keys. The keys are limited to the EXIF keys provided by the platform. See "Platform notes" for more details.

await exif.writeAttribute("key", "value");
await exif.writeAttributes({"key1": "value1", "key2": "value2"});
Close the exif interface
await exif.close();

Platform notes

This plugin does only work on iOS and Android. Other platforms are not yet supported.

Android

This plugin uses the androidx ExifInterface.

[!IMPORTANT] Only specific EXIF and GPS attributes are supported. Please look for val tags = ... at android/src/main/kotlin/com/cloudacy/native_exif/NativeExifPlugin.kt for a list of supported attributes.

All raw attribute values must be of type String.

[!IMPORTANT] Currently this plugin can only write ASCII characters correctly due to ExifInterface limitations.

Values for GPSLatitude and GPSLongitude can be written as negative values but will be returned as positive values. Use GPSLatitudeRef and GPSLongitudeRef or getLatLong() to determine the correct coordinates.

iOS

[!IMPORTANT] Only specific EXIF and GPS attributes are supported. Please look at EXIF dictionary keys and GPS dictionary keys for supported attributes.

Please note that all GPS dictionary keys need to be prefixed with GPS. For example: kCGImagePropertyGPSLatitude == "Latitude", which equals to "GPSLatitude" in native_exif.

Values for GPSLatitude and GPSLongitude should be of type String and can be written as negative values but will be returned as positive values. Use GPSLatitudeRef and GPSLongitudeRef or getLatLong() to determine the correct coordinates.

API Docs

For code docs, you can use the automatically generated reference on pub.dev.

Example

For a better usage example, see the example folder or use the example page on pub.dev.

所属分类

依赖

依赖清单 1 项

  • intl>=0.19.0 <0.21.0

源码仓库

使用此插件的项目