Gathering detailed insights and metrics for get-orientation
Gathering detailed insights and metrics for get-orientation
Gathering detailed insights and metrics for get-orientation
Gathering detailed insights and metrics for get-orientation
jpeg-buffer-orientation
Get orientation of JPEG file.
react-native-orientation-locker
A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
robust-orientation
Exactly computes the orientation of a tuple of points
@progress/kendo-angular-progressbar
Kendo UI Angular component starter template
Get orientation from EXIF of image file. Supports both Browser and Node.js
npm install get-orientation
97.9
Supply Chain
99.5
Quality
75.3
Maintenance
100
Vulnerability
99.6
License
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
117 Stars
148 Commits
3 Forks
3 Watching
31 Branches
3 Contributors
Updated on 10 May 2024
TypeScript (79.93%)
JavaScript (13.24%)
HTML (6.84%)
Cumulative downloads
Total Downloads
Last day
-17.2%
14,669
Compared to previous day
Last week
2.5%
101,338
Compared to previous week
Last month
2.2%
444,928
Compared to previous month
Last year
-52.2%
7,469,074
Compared to previous year
1
Get orientation from EXIF of image file. Supports both Browser and Server (Node.js) environment.
get-orientation
has fast, efficient built-in EXIF parser.
Built-in EXIF Parser is stream-based, and uses small memory footprint.
Also, Compatibility is the key. get-orientation
was tested with 50+ test images.
https://mooyoul.github.io/get-orientation/
Most Browsers don't rotate images automatically.
Hmm... How about adaption stats of CSS3 Image Orientation?
Well. Good luck.
To rotate image by its orientation, you'll have to make a EXIF parser or install heavy EXIF related libraries.
That's why i made this.
get-orientation works in major environments, including IE 10.
Platform | Environment | Build | Compatibility |
---|---|---|---|
macOS Mojave | Node.js 4 | Default | Compatible |
macOS Mojave | Node.js 6 | Default | Compatible |
Linux Ubuntu Trusty | Node.js 6 | Default | Compatible |
macOS Mojave | Node.js 8 | Default | Compatible |
Linux Ubuntu Trusty | Node.js 10 | Default | Compatible |
macOS Mojave | Node.js 10 | Default | Compatible |
Platform | Environment | Build | Compatibility |
---|---|---|---|
Windows XP/7 | ~ IE 9 | N/A | Incompatible due to missing FileReader/DataView support |
Windows 7 | IE 10 | Browser/ES5 | Compatible, Requires Promise and WeakMap polyfill |
Windows 7 | IE 11 | Browser/ES5 | Compatible, Requires Promise polyfill |
Windows 10 | IE 11 | Browser/ES5 | Compatible, Requires Promise polyfill |
macOS Mojave | Chrome 74 | Browser/ES6 (Default) | Compatible |
macOS Mojave | Safari | Browser/ES6 (Default) | Compatible |
macOS Mojave | Safari TP | Browser/ES6 (Default) | Compatible |
macOS Mojave | Firefox Developer Edition 67 | Browser/ES6 (Default) | Compatible |
macOS Mojave | Firefox 65 | Browser/ES6 (Default) | Compatible |
iOS 12.0.1 | Safari | Browser/ES6 (Default) | Compatible |
Android 5 | Mobile Chrome 74 | Browser/ES6 (Default) | Compatible |
1$ npm install get-orientation
1<!-- ES6 Target Build (default) --> 2<script type="text/javascript" src="https://unpkg.com/get-orientation/browser"></script> 3 4<!-- ES5 Target Build (for Compat, requires Promise, WeakMap polyfill --> 5<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/core-js/2.6.5/core.min.js"></script> 6<script type="text/javascript" src="https://unpkg.com/get-orientation/browser.es5"></script>
JPEG/JFIF
JPEG/EXIF
TIFF/EXIF
1 2import * as fs from "fs"; 3import { getOrientation } from "get-orientation"; 4 5// using Readable File Stream as input 6const stream = fs.createReadStream(imageFilePath); 7const orientation = await getOrientation(stream); 8 9// using Buffer as input 10const bufFile = fs.readFileSync(imageFilePath); 11const orientation = await getOrientation(bufFile); 12 13// using HTTP Response body as input 14import axios from "axios"; 15const response = await axios({ url, responseType: "stream" }); 16const orientation = await getOrientation(response.data); 17 18 19// using Stream interface directly 20import { EXIFOrientationParser, Orientation } from "get-orientation"; 21 22const parser = new EXIFOrientationParser(); 23parser.on("orientation", (orientation: Orientation) => { 24 console.log("got orientation: ", orientation); 25}); 26 27fs.createReadStream(imageFilePath).pipe(parser);
1import { getOrientation } from "get-orientation/browser"; 2 3async function onFileChanged() { 4 const orientation = await getOrientation(fileInput.files[0]); 5 // do stuff... 6}
IMPORTANT NOTE
The ES5 target browser build does not include any Polyfills like Promise/A+. For example, To use this library from Microsoft Internet Explorer 11, You'll have to polyfill Promise.
getOrientation(input: Buffer | ReadableStream)
=> Promise<Orientation>
returns Orientation of given image.
If image is non-jpeg image, or non-image, getOrientation
will return Orientation.TOP_LEFT (Horizontal - Default value).
new EXIFOrientationParser()
=> WritableStream
returns a parser stream instance that implements WritableStream interface.
Please note that EXIFOrientationParser won't emit any orientation
event if stream doesn't have any Orientation tags.
also, Stream will be closed without any errors.
For example, Using non-EXIF images, non-JPEG images as input won't emit a orientation
event.
orientation
emitted after parsing orientation.
getOrientation(input: ArrayBuffer | Blob | File)
=> Promise<Orientation>
returns Orientation of given image.
If image is non-jpeg image, or non-image, getOrientation
will return Orientation.TOP_LEFT (Horizontal - Default value).
1enum Orientation { 2 TOP_LEFT = 1, // Horizontal (Default) 3 TOP_RIGHT = 2, // Mirror Horizontal 4 BOTTOM_RIGHT = 3, // Rotate 180 5 BOTTOM_LEFT = 4, // Mirror vertical 6 LEFT_TOP = 5, // Mirror horizontal and rotate 270 CW 7 RIGHT_TOP = 6, // Rotate 90 CW 8 RIGHT_BOTTOM = 7, // Mirror horizontal and rotate 90 CW 9 LEFT_BOTTOM = 8, // Rotate 270 CW 10}
See CHANGELOG.
1$ npm run test
get-orientation uses BrowserStack for compatibility testing.
1$ npm run build
See full license on mooyoul.mit-license.org
No vulnerabilities found.
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
Found 0/24 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Reason
53 existing vulnerabilities detected
Details
Score
Last Scanned on 2024-11-18
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More