パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v0.5.2

flutter_exif_rotation

一部のデバイスで横向に撮影された画像の向きを修正するFlutterプラグイン。

AndroidiOS
30日間ダウンロード
4.8万
いいね数
96
Pub ポイント
150

パッケージをインストール

flutter pub add flutter_exif_rotation

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

特定のデバイスが横向きモードで写真を撮影した際に発生する画像の向きの問題を自動的に修正するFlutterプラグインです。画像からEXIFメタデータを読み取り、正しい回転角度を判断して適用することで、手動調整なしに画像を正しく表示します。ユーザーがアップロードした写真を扱うアプリケーションでは、向きの一貫性が重要であるため、特に有用です。このプラグインはAndroidおよびiOSの両方のプラットフォームをサポートしており、既存の画像処理ワークフローにスムーズに統合できます。

用途

  • モバイルカメラからの回転画像の修正
  • ギャラリーでの画像表示の一貫性を確保する
  • 写真の向きの補正を自動化する
  • 写真アップロード機能におけるユーザー体験の向上
  • デバイスのカメラから画像を直接処理する

主な機能

  • EXIFの方向データを読み取ります
  • メタデータに基づいて画像を自動的に回転します
  • Android および iOS をサポートしています
  • 軽量で統合が簡単
  • 元の画像品質を維持する

適している対象

  • 画像ギャラリーアプリケーション
  • 写真共有プラットフォーム
  • カメラ統合アプリ
  • 正確な画像レンダリングを必要とするアプリ
  • 自動的な方位修正が必要な開発者

注意事項

  • 画像ファイルへのアクセス権限が必要です
  • すべての画像形式で動作しない可能性があります
  • EXIFデータの存在に依存しています
  • 方向補正のみに限定
  • 画像ファイル以外には適していません

元の README

関連するソースリポジトリの README 原文のスナップショットです。最新の内容はリポジトリをご覧ください。

Fix exif rotation for flutter

pub package

Flutter plugin that fixes the picture orientation for some devices. In some devices the exif data shows picture in landscape mode when they're actually in portrait. This plugin fixes the orientation for pictures taken with those devices.

Every version of Android is supported. iOS implemented by @Bhagatcliffex and currently supported

Android

Add this in your AndroidManifest.xml (you don't need these permissions in case when you manipulate files from internal storage only (file are stored inside the app's directory ( /data/data/{your package}/ )) )

Example
import 'dart:async';
import 'dart:io';

import 'package:flutter/material.dart';
import 'package:flutter_exif_rotation/flutter_exif_rotation.dart';
import 'package:image_picker/image_picker.dart';

void main() => runApp(MyApp());

/// The stateful widget
class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

/// The class with the scaffold
class _MyAppState extends State<MyApp> {
  File _image;
  final picker = ImagePicker();

  Future getImage() async {
    final image = await picker.getImage(source: ImageSource.gallery);
    if (image != null && image.path != null) {
      File rotatedImage =
          await FlutterExifRotation.rotateImage(path: image.path);

      if (image != null) {
        setState(() {
          _image = rotatedImage;
        });
      }
    }
  }

  Future getImageAndSave() async {
    final image = await picker.getImage(source: ImageSource.gallery);
    if (image != null && image.path != null) {
      File rotatedImage =
          await FlutterExifRotation.rotateAndSaveImage(path: image.path);

      if (image != null) {
        setState(() {
          _image = rotatedImage;
        });
      }
    }
  }

  @override
  void initState() {
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Exif flutter rotation image example app'),
        ),
        body: new Center(
          child: _image == null
              ? new Text('No image selected.')
              : new Image.file(_image),
        ),
        persistentFooterButtons: <Widget>[
          new FloatingActionButton(
            onPressed: getImageAndSave,
            tooltip: 'Pick Image and save',
            child: new Icon(Icons.save),
          ),
          new FloatingActionButton(
            onPressed: getImage,
            tooltip: 'Pick Image without saving',
            child: new Icon(Icons.add),
          ),
        ],
      ),
    );
  }
}

カテゴリー

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。