New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

exif-orient

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

exif-orient

Library to orient images based on their Exif orientation

  • 0.0.5
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
262
decreased by-23.84%
Maintainers
1
Weekly downloads
 
Created
Source

Orient an image based on its Exif orientation tag and draw it to a canvas for further processing.

See a demo.

Install from NPM or Bower:

npm install exif-orient --save
bower install exif-orient --save

Usage

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
  })
})

Changes

v0.0.5

  • Enforce argument types and values
  • Allow canvas to be used as an argument of exifOrient

v0.0.4

  • Add semicolon at EOF to be friendly with minifiers

v0.0.3

  • Rename EXIF => Exif

v0.0.2

  • Update README

v0.0.1

  • Initial release

Keywords

FAQs

Package last updated on 22 Oct 2016

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc