JSPM

@prmichaelsen/fix-image-orientation

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

Accepts a Blob of an image file as an argument and returns the dataURL with orientation applied and exif removed.

Package Exports

  • @prmichaelsen/fix-image-orientation
  • @prmichaelsen/fix-image-orientation/lib/cjs/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 (@prmichaelsen/fix-image-orientation) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

@prmichaelsen/fix-image-orientation

npm Build and test license

Accepts a Blob of an image file as an argument and returns the dataURL with orientation applied and exif removed.

Features

  • Zero Dependency
  • Lightweight

Usage

<input id="file" type="file" />
<img id="preview" />

<script>
  const preview = document.getElementById("preview");
  const input = document.getElementById("file");

  input.addEventListener("change", (event) => {
    const file = event.target.files[0];

    imageFileToOrientationFixedDataURL(file).then((url) => {
      preview.src = url; // data:image/png;base64,iVBORw0K...
    });
  });
</script>

Supported Format

  • jpeg
  • png

If an unsupported format is received, it returns dataURL without processing.

Installation

npm install --save @prmichaelsen/fix-image-orientation