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
react-native-orientation-locker
A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
@hortau/react-native-orientation-locker
A react-native module that can listen on orientation changing of device, get current orientation, lock to preferred orientation.
screen-orientation
Get the current screen orientation
vue-img-orientation-changer
vue-plugin can help you get images with correct orientation
Get orientation from EXIF of image file. Supports both Browser and Node.js
npm install get-orientation
Typescript
Module System
Node Version
NPM Version
98.8
Supply Chain
99.5
Quality
75.3
Maintenance
100
Vulnerability
99.6
License
TypeScript (79.93%)
JavaScript (13.24%)
HTML (6.84%)
Total Downloads
108,535,559
Last Day
8,790
Last Week
123,026
Last Month
537,648
Last Year
5,454,802
MIT License
118 Stars
148 Commits
3 Forks
2 Watchers
31 Branches
3 Contributors
Updated on May 22, 2025
Minified
Minified + Gzipped
Latest Version
1.1.2
Package Id
get-orientation@1.1.2
Size
13.59 kB
NPM Version
6.11.3
Node Version
8.16.1
Published on
Oct 01, 2019
Cumulative downloads
Total Downloads
Last Day
-28.6%
8,790
Compared to previous day
Last Week
-12.5%
123,026
Compared to previous week
Last Month
7.1%
537,648
Compared to previous month
Last Year
-50.3%
5,454,802
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
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
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 0/24 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no effort to earn an OpenSSF best practices badge detected
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
61 existing vulnerabilities detected
Details
Score
Last Scanned on 2025-06-23
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