@prmichaelsen/fix-image-orientation
TypeScript icon, indicating that this package has built-in type declarations

1.0.4 • Public • Published

@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

Package Sidebar

Install

npm i @prmichaelsen/fix-image-orientation

Weekly Downloads

5

Version

1.0.4

License

MIT

Unpacked Size

29.3 kB

Total Files

25

Last publish

Collaborators

  • prmichaelsen