Search packages, repositories and app categories

Package detailsv0.5.2

flutter_exif_rotation

Flutter plugin that fixes the picture orientation when it's took in landscape for some devices.

AndroidiOS
30-day downloads
47.8K
Likes
96
Pub points
150

Install package

flutter pub add flutter_exif_rotation

Package Overview

Package selection guidance compiled from public package information, community data, and project usage.

A Flutter plugin that automatically corrects image orientation issues caused by certain devices capturing photos in landscape mode. It reads EXIF metadata from images to determine the correct rotation angle and applies it, ensuring images are displayed properly without manual adjustment. This is particularly useful for apps handling user-uploaded photos where orientation consistency is critical. The plugin supports both Android and iOS platforms and integrates seamlessly into existing image processing workflows.

Use cases

  • Fixing rotated images from mobile cameras
  • Ensuring consistent image display in galleries
  • Automating photo orientation correction
  • Improving user experience in photo upload features
  • Processing images from device camera directly

Key features

  • Reads EXIF orientation data
  • Automatically rotates images based on metadata
  • Supports Android and iOS
  • Lightweight and easy to integrate
  • Preserves original image quality

Suitable for

  • Image gallery applications
  • Photo sharing platforms
  • Camera-integrated apps
  • Apps requiring accurate image rendering
  • Developers needing automatic orientation fixes

Considerations

  • Requires image file access permissions
  • May not work with all image formats
  • Depends on EXIF data being present
  • Limited to orientation correction only
  • Not suitable for non-image files

Original README

Original README snapshot from the linked source repository. Visit the repository for the latest content.

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),
          ),
        ],
      ),
    );
  }
}

Categories

Source repository

Projects using this package

No data available yet.