JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2746
  • Score
    100M100P100Q144047F
  • License MIT

`exif-auto-rotate` is a module that helps you for applying the right orientation to JPEG images, based on its EXIF tag. It applies the right orientation to a JPEG image. Resets to orientation 1 from all orientation codes. It returns of new image's base64 URI or Blob.

Package Exports

  • exif-auto-rotate
  • exif-auto-rotate/build/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (exif-auto-rotate) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

Exif Auto Rotate

All Contributors

Build Status

exif-auto-rotate is a module that helps you for applying the right orientation to JPEG images, based on its EXIF tag.

  • Resets to orientation 1 from all orientation codes. It returns of new image's base64 URI or Blob.
  • The URI can be used as the source of an <Image> component.

Setup

Install the package:

npm i exif-auto-rotate

or

yarn add exif-auto-rotate

Usage

import Rotator from 'exif-auto-rotate';

// sync
Rotator.createRotatedImage(
  file, // the file of the new image that can now be uploaded.
  outputType  // the output type of the new image.
  responseUriFunc,  // the callBack function of the new image URI
);

// async
Rotator.createRotatedImageAsync(
  file, // the file of the new image that can now be uploaded.
  outputType  // the output type of the new image.
);

Examples

// sync
Rotator.createRotatedImage(file, "base64", (uri) => {
  console.log(uri);
});

// async
try {
  const file = event.target.files[0];
  const uri = Rotator.createRotatedImageAsync(file, "base64");
  console.log(uri);
} catch (err) {
  console.log(err);
}
Option Description Type Required
file Path of image file object Yes
outputType Can be either base64 or blob.(Default type is base64) string No
responseUriFunc Callback function of URI. Returns URI of rotated image's base64 or Blob format. ex: uri => {console.log(uri)}); function Yes (sync only)

License

MIT

Contributors

Contributions of any kind welcome!


Pablo Suarez

🚧 💻

Stephan Bijzitter

🚧 💻