exifreader
Advanced tools
Comparing version 4.13.1 to 4.13.2
{ | ||
"name": "exifreader", | ||
"version": "4.13.1", | ||
"version": "4.13.2", | ||
"description": "Library that parses Exif metadata in images.", | ||
@@ -5,0 +5,0 @@ "author": "Mattias Wallander <mattias@wallander.eu>", |
@@ -15,8 +15,16 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
export const IFD_TYPE_0TH = '0th'; | ||
export const IFD_TYPE_1ST = '1st'; | ||
export const IFD_TYPE_EXIF = 'exif'; | ||
export const IFD_TYPE_GPS = 'gps'; | ||
export const IFD_TYPE_INTEROPERABILITY = 'interoperability'; | ||
export const IFD_TYPE_MPF = 'mpf'; | ||
export default { | ||
'0th': tagNames0thExifIfds, | ||
'exif': tagNames0thExifIfds, | ||
'gps': TagNamesGpsIfd, | ||
'interoperability': TagNamesInteroperabilityIfd, | ||
'mpf': Constants.USE_MPF ? TagNamesMpfIfd : {}, | ||
[IFD_TYPE_0TH]: tagNames0thExifIfds, | ||
[IFD_TYPE_1ST]: TagNames0thIfd, | ||
[IFD_TYPE_EXIF]: tagNames0thExifIfds, | ||
[IFD_TYPE_GPS]: TagNamesGpsIfd, | ||
[IFD_TYPE_INTEROPERABILITY]: TagNamesInteroperabilityIfd, | ||
[IFD_TYPE_MPF]: Constants.USE_MPF ? TagNamesMpfIfd : {}, | ||
}; |
@@ -9,3 +9,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
import Types from './types.js'; | ||
import TagNames from './tag-names.js'; | ||
import TagNames, {IFD_TYPE_0TH, IFD_TYPE_1ST, IFD_TYPE_EXIF, IFD_TYPE_GPS, IFD_TYPE_INTEROPERABILITY, IFD_TYPE_MPF} from './tag-names.js'; | ||
import {deferInit, getBase64Image} from './utils.js'; | ||
@@ -45,3 +45,3 @@ | ||
function read0thIfd(dataView, tiffHeaderOffset, byteOrder, includeUnknown) { | ||
return readIfd(dataView, '0th', tiffHeaderOffset, get0thIfdOffset(dataView, tiffHeaderOffset, byteOrder), byteOrder, includeUnknown); | ||
return readIfd(dataView, IFD_TYPE_0TH, tiffHeaderOffset, get0thIfdOffset(dataView, tiffHeaderOffset, byteOrder), byteOrder, includeUnknown); | ||
} | ||
@@ -55,3 +55,3 @@ | ||
if (tags[EXIF_IFD_POINTER_KEY] !== undefined) { | ||
return objectAssign(tags, readIfd(dataView, 'exif', tiffHeaderOffset, tiffHeaderOffset + tags[EXIF_IFD_POINTER_KEY].value, byteOrder, includeUnknown)); | ||
return objectAssign(tags, readIfd(dataView, IFD_TYPE_EXIF, tiffHeaderOffset, tiffHeaderOffset + tags[EXIF_IFD_POINTER_KEY].value, byteOrder, includeUnknown)); | ||
} | ||
@@ -64,3 +64,3 @@ | ||
if (tags[GPS_INFO_IFD_POINTER_KEY] !== undefined) { | ||
return objectAssign(tags, readIfd(dataView, 'gps', tiffHeaderOffset, tiffHeaderOffset + tags[GPS_INFO_IFD_POINTER_KEY].value, byteOrder, includeUnknown)); | ||
return objectAssign(tags, readIfd(dataView, IFD_TYPE_GPS, tiffHeaderOffset, tiffHeaderOffset + tags[GPS_INFO_IFD_POINTER_KEY].value, byteOrder, includeUnknown)); | ||
} | ||
@@ -73,3 +73,3 @@ | ||
if (tags[INTEROPERABILITY_IFD_POINTER_KEY] !== undefined) { | ||
return objectAssign(tags, readIfd(dataView, 'interoperability', tiffHeaderOffset, tiffHeaderOffset + tags[INTEROPERABILITY_IFD_POINTER_KEY].value, byteOrder, includeUnknown)); | ||
return objectAssign(tags, readIfd(dataView, IFD_TYPE_INTEROPERABILITY, tiffHeaderOffset, tiffHeaderOffset + tags[INTEROPERABILITY_IFD_POINTER_KEY].value, byteOrder, includeUnknown)); | ||
} | ||
@@ -82,3 +82,3 @@ | ||
const byteOrder = ByteOrder.getByteOrder(dataView, dataOffset); | ||
const tags = readIfd(dataView, 'mpf', dataOffset, get0thIfdOffset(dataView, dataOffset, byteOrder), byteOrder, includeUnknown); | ||
const tags = readIfd(dataView, IFD_TYPE_MPF, dataOffset, get0thIfdOffset(dataView, dataOffset, byteOrder), byteOrder, includeUnknown); | ||
return addMpfImages(dataView, dataOffset, tags, byteOrder); | ||
@@ -238,4 +238,4 @@ } | ||
const nextIfdOffset = Types.getLongAt(dataView, offset, byteOrder); | ||
if (nextIfdOffset !== 0) { | ||
tags['Thumbnail'] = readIfd(dataView, ifdType, tiffHeaderOffset, tiffHeaderOffset + nextIfdOffset, byteOrder, true); | ||
if (nextIfdOffset !== 0 && ifdType === IFD_TYPE_0TH) { | ||
tags['Thumbnail'] = readIfd(dataView, IFD_TYPE_1ST, tiffHeaderOffset, tiffHeaderOffset + nextIfdOffset, byteOrder, true); | ||
} | ||
@@ -242,0 +242,0 @@ } |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
582182
5952