1.5.0 • Published 4 months ago

exif-rotate-js v1.5.0

Weekly downloads
1,525
License
MIT
Repository
github
Last release
4 months ago

exif-rotate-js ・ CircleCI

When you use input file, you can get base64 string as array without worrying about orientation of exif.

Usage

$ npm install exif-rotate-js

API

const data = await getBase64Strings(files, {maxSize, type, quality}))

Return Values

  • a promise returning array string as base64 like ["data:image/jpeg;base64,/9j/4AAQS..."]

Parameters

  • files: input target files. User can select multiple files.
  • maxSize = 720: canvas max size. When image's width is greater than height, maxSize applies to width. And vice versa.
  • type = 'image/jpeg': the mime type of the generated image. Any mime type supported by HTMLCanvasElement.toDataURL() is supported.
  • quality (optional): a number between 0 and 1 indicating the image quality to use for image formats that use lossy compression such as image/jpeg and image/webp. If this argument is anything else, the default value for image quality is used. As per the spec, the default (undefined) value will use 0.92.

Example

import { getBase64Strings } from 'exif-rotate-js';

const elem = document.getElementById('fileImage');

if (elem) {
  elem.onchange = async (e) => {
    if (!e.target) return;
    const data = await getBase64Strings(e.target.files, { maxSize: 1024 });
    console.log(data); // ["data:image/jpeg;base64,/9j/4AAQS..."] as type of Array
  };
}
1.5.0

4 months ago

1.4.0

2 years ago

1.3.0

4 years ago

1.2.1

4 years ago

1.2.0

4 years ago

1.1.1

4 years ago

1.1.0

4 years ago

1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago

0.0.1

8 years ago