src/main.js
function parseOrientationTag({buffer, exifData}) {
  let orientation = null
  if (exifData['0th'] && exifData['0th'][piexif.ImageIFD.Orientation]) {
    orientation = parseInt(exifData['0th'][piexif.ImageIFD.Orientation])
  }
  if (orientation === null) {
    throw new CustomError(m.errors.no_orientation, 'No orientation tag found in EXIF', buffer)
  }
  if (isNaN(orientation) || orientation < 1 || orientation > 8) {
    throw new CustomError(m.errors.unknown_orientation, 'Unknown orientation (' + orientation + ')', buffer)
  }
  if (orientation === 1) {
    throw new CustomError(m.errors.correct_orientation, 'Orientation already correct', buffer)
  }
  return orientation
}
function parseOrientationTag({buffer, exifData}) {
  let orientation = null
  if (exifData['0th'] && exifData['0th'][piexif.ImageIFD.Orientation]) {
    orientation = parseInt(exifData['0th'][piexif.ImageIFD.Orientation])
  }
  if (orientation === null) {
    throw new CustomError(m.errors.no_orientation, 'No orientation tag found in EXIF', buffer)
  }
  if (isNaN(orientation) || orientation < 1 || orientation > 8) {
    throw new CustomError(m.errors.unknown_orientation, 'Unknown orientation (' + orientation + ')', buffer)
  }
  if (orientation === 1) {
    throw new CustomError(m.errors.correct_orientation, 'Orientation already correct', buffer)
  }
  return orientation
}
function parseOrientationTag ( { buffer , exifData } ) { let orientation = null if ( exifData [ '0th' ] && exifData [ '0th' ] [ piexif . ImageIFD . Orientation ] ) { orientation = parseInt ( exifData [ '0th' ] [ piexif . ImageIFD . Orientation ] ) } if ( orientation === null ) { throw new CustomError ( m . errors . no_orientation , 'No orientation tag found in EXIF' , buffer ) } if ( isNaN ( orientation ) || orientation < 1 || orientation > 8 ) { throw new CustomError ( m . errors . unknown_orientation , 'Unknown orientation (' + orientation + ')' , buffer ) } if ( orientation === 1 ) { throw new CustomError ( m . errors . correct_orientation , 'Orientation already correct' , buffer ) } return orientation }
Extract the orientation tag from the given EXIF data
Extract the orientation tag from the given EXIF data