Skip to content

Commit

Permalink
feat: expose exif buffers
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickhulce committed Sep 7, 2018
1 parent 79c4c7e commit 2341ab7
Show file tree
Hide file tree
Showing 3 changed files with 172 additions and 124 deletions.
11 changes: 11 additions & 0 deletions lib/decoder.js
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,16 @@ var JpegImage = (function jpegImage() {
}
}
// TODO APP1 - Exif
if (fileMarker === 0xFFE1) {
if (appData[0] === 0x45 &&
appData[1] === 0x78 &&
appData[2] === 0x69 &&
appData[3] === 0x66 &&
appData[4] === 0) { // 'EXIF\x00'
this.exifBuffer = appData.slice(5);
}
}

if (fileMarker === 0xFFEE) {
if (appData[0] === 0x41 && appData[1] === 0x64 && appData[2] === 0x6F &&
appData[3] === 0x62 && appData[4] === 0x65 && appData[5] === 0) { // 'Adobe\x00'
Expand Down Expand Up @@ -1007,6 +1017,7 @@ function decode(jpegData, opts) {
var image = {
width: decoder.width,
height: decoder.height,
exifBuffer: decoder.exifBuffer,
data: opts.useTArray ?
new Uint8Array(decoder.width * decoder.height * 4) :
new Buffer(decoder.width * decoder.height * 4)
Expand Down
Loading

0 comments on commit 2341ab7

Please sign in to comment.