JSPM

@prmichaelsen/fix-image-orientation

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

When this function receives a Blob of an image file as an argument, it returns the dataURL with orientation applied and exif removed.

Package Exports

  • @prmichaelsen/fix-image-orientation
  • @prmichaelsen/fix-image-orientation/lib/cjs/index.js
  • @prmichaelsen/fix-image-orientation/lib/esm/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

@mish-tv/fix-image-orientation

npm Build and test license

When this function receives a Blob of an image file as an argument, it 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 @mish-tv/fix-image-orientation