搜尋套件、儲存庫與 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

原始碼儲存庫

使用此套件的專案