![require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages](https://cdn.sanity.io/images/cgdhsj6q/production/be8ab80c8efa5907bc341c6fefe9aa20d239d890-1600x1097.png?w=400&fit=max&auto=format)
Security News
require(esm) Backported to Node.js 20, Paving the Way for ESM-Only Packages
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
exif-orient
Advanced tools
Orient an image based on its Exif orientation tag and draw it to a canvas for further processing.
Install from NPM or Bower:
npm install exif-orient --save
bower install exif-orient --save
This library exports a single function exifOrient
(support UMD):
/**
* @param {HTMLImageElement | HTMLCanvasElement | String} img - image, canvas, base64 string or URL.
* @param {Number} orientation - the Exif orientation.
* @param {Function} cb (optional) - the callback function.
* @return {HTMLCanvasElement} a canvas object.
*/
exifOrient(img, orientation, cb)
Example
// 1. Read orientation tag using exif-js (https://github.com/exif-js/exif-js)
// Note: can use any Exif parsing library, exif-js is just an example
EXIF.getData(img, function () {
var orientation = img.exifdata.Orientation
// 2. Invoke `exifOrient` to orient the image and get back a canvas
exifOrient(img, orientation, function (err, canvas) {
// 3. Do whatever you want with the canvas, e.g. render it into an image
})
})
v0.0.5
v0.0.4
v0.0.3
v0.0.2
v0.0.1
FAQs
Library to orient images based on their Exif orientation
The npm package exif-orient receives a total of 218 weekly downloads. As such, exif-orient popularity was classified as not popular.
We found that exif-orient demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
require(esm) backported to Node.js 20, easing the transition to ESM-only packages and reducing complexity for developers as Node 18 nears end-of-life.
Security News
PyPI now supports iOS and Android wheels, making it easier for Python developers to distribute mobile packages.
Security News
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.