exifreader
Advanced tools
Comparing version 4.17.0 to 4.18.0
@@ -127,2 +127,4 @@ /// <reference types="node" /> | ||
type StringTag = TypedTag<string>; | ||
interface ValueTag { | ||
@@ -179,2 +181,3 @@ description: string, | ||
gps?: GpsTags | ||
photoshop?: PhotoshopTags; | ||
} | ||
@@ -221,2 +224,10 @@ | ||
interface PhotoshopTags { | ||
// CaptionDigest: StringTag; | ||
// PrintInformation: StringTag; | ||
// PrintStyle: StringTag; | ||
PathInformation: StringTag; | ||
ClippingPathName: StringTag; | ||
} | ||
export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer): Tags; | ||
@@ -479,3 +490,3 @@ export function load(data: ArrayBuffer | SharedArrayBuffer | Buffer, options: {expanded: true, includeUnknown?: boolean, length?: number}): ExpandedTags; | ||
export type Tags = XmpTags & IccTags & PngTags & RiffTags & { | ||
export type Tags = XmpTags & IccTags & PngTags & RiffTags & PhotoshopTags & { | ||
'Thumbnail'?: ThumbnailTags; | ||
@@ -482,0 +493,0 @@ 'Images'?: MPFImageTags[], |
{ | ||
"name": "exifreader", | ||
"version": "4.17.0", | ||
"version": "4.18.0", | ||
"description": "Library that parses Exif metadata in images.", | ||
@@ -65,3 +65,3 @@ "author": "Mattias Wallander <mattias@wallander.eu>", | ||
"test:all": "npm-run-all lint test:types coverage test:e2e test:build test:build:custom", | ||
"pre-commit": "npm-run-all lint test test:build", | ||
"pre-commit": "npm-run-all lint test:types test test:build", | ||
"postinstall": "node bin/build.js --only-with-config", | ||
@@ -68,0 +68,0 @@ "prepare": "husky install" |
@@ -21,12 +21,17 @@ ExifReader | ||
| File type | Exif | IPTC | XMP | ICC | MPF | Thumbnail | | ||
| ----------|---------|---------|---------|---------|---------|-----------| | ||
| JPEG | **yes** | **yes** | **yes** | **yes** | **yes** | **yes** | | ||
| TIFF | **yes** | **yes** | **yes** | **yes** | ??? | no | | ||
| PNG | **yes** | no | **yes** | no | ??? | no | | ||
| HEIC/HEIF | **yes** | no | no | **yes** | ??? | no | | ||
| WebP | **yes** | no | **yes** | **yes** | ??? | **yes** | | ||
| File type | Exif | IPTC | XMP | ICC | MPF | Photoshop | Thumbnail | | ||
| ----------|---------|---------|---------|---------|---------|---------------|-----------| | ||
| JPEG | **yes** | **yes** | **yes** | **yes** | **yes** | **some*** | **yes** | | ||
| TIFF | **yes** | **yes** | **yes** | **yes** | ??? | ??? | no | | ||
| PNG | **yes** | no | **yes** | no | ??? | ??? | no | | ||
| HEIC/HEIF | **yes** | no | no | **yes** | ??? | ??? | no | | ||
| WebP | **yes** | no | **yes** | **yes** | ??? | ??? | **yes** | | ||
??? = MPF may be supported in any file type using Exif since it's an Exif | ||
extension, but it has only been tested on JPEGs. | ||
- ??? = may be supported in any file type using Exif but it has only been tested | ||
on JPEGs. | ||
- * = A draft implementation of Photoshop tags have been added with | ||
`ClippingPathName` and `PathInformation` currently supported. Photoshop tags | ||
are very different from other tags and need a lot of extra code so they have | ||
deliberately not been fully implemented. File an issue if there is something | ||
you think should really be supported. | ||
@@ -414,3 +419,3 @@ If you're missing something that you think should be supported, file an issue | ||
| `png_file` | PNG file details: image width, height etc. | | ||
| `exif` | Regular Exif tags. If excluded, will also exclude `mpf` and `thumbnail`. For TIFF files, excluding this will also exclude IPTC, XMP, and ICC. | | ||
| `exif` | Regular Exif tags. If excluded, will also exclude `mpf`, `photoshop` and `thumbnail`. For TIFF files, excluding this will also exclude IPTC, XMP, and ICC. | | ||
| `iptc` | IPTC tags. | | ||
@@ -420,2 +425,3 @@ | `xmp` | XMP tags. | | ||
| `mpf` | Multi-picture Format tags. | | ||
| `photoshop` | Photoshop tags. | | ||
| `thumbnail` | Thumbnail. Needs `exif`. | | ||
@@ -422,0 +428,0 @@ |
@@ -14,2 +14,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
USE_MPF: true, | ||
USE_PHOTOSHOP: true, | ||
USE_THUMBNAIL: true, | ||
@@ -16,0 +17,0 @@ USE_TIFF: true, |
@@ -23,2 +23,3 @@ /** | ||
import XmpTags from './xmp-tags.js'; | ||
import PhotoshopTags from './photoshop-tags.js'; | ||
import IccTags from './icc-tags.js'; | ||
@@ -270,2 +271,11 @@ import PngFileTags from './png-file-tags.js'; | ||
if (Constants.USE_PHOTOSHOP && readTags['ImageSourceData']) { | ||
const readPhotoshopTags = PhotoshopTags.read(readTags['PhotoshopSettings'].value, includeUnknown); | ||
if (expanded) { | ||
tags.photoshop = readPhotoshopTags; | ||
} else { | ||
tags = objectAssign({}, tags, readPhotoshopTags); | ||
} | ||
} | ||
if (Constants.USE_TIFF && Constants.USE_ICC && readTags['ICC_Profile'] && !hasIccData(iccChunks)) { | ||
@@ -272,0 +282,0 @@ const readIccTags = IccTags.read( |
@@ -180,2 +180,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
0x9292: 'SubSecTimeDigitized', | ||
0x935c: 'ImageSourceData', | ||
0x9400: { | ||
@@ -182,0 +183,0 @@ 'name': 'AmbientTemperature', |
@@ -5,2 +5,12 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
import DataViewWrapper from './dataview.js'; | ||
export function getDataView(data, byteOffset, byteLength) { | ||
try { | ||
return new DataView(data, byteOffset, byteLength); | ||
} catch (error) { | ||
return new DataViewWrapper(data, byteOffset, byteLength); | ||
} | ||
} | ||
export function getStringFromDataView(dataView, offset, length) { | ||
@@ -19,5 +29,14 @@ const chars = []; | ||
} | ||
if (chars[chars.length - 1] === 0) { | ||
chars.pop(); | ||
} | ||
return getStringValueFromArray(chars); | ||
} | ||
export function getPascalStringFromDataView(dataView, offset) { | ||
const size = dataView.getUint8(offset); | ||
const string = getStringFromDataView(dataView, offset + 1, size); | ||
return [size, string]; | ||
} | ||
export function getStringValueFromArray(charArray) { | ||
@@ -104,1 +123,15 @@ return charArray.map((charCode) => String.fromCharCode(charCode)).join(''); | ||
} | ||
export function padStart(string, length, character) { | ||
const padding = strRepeat(character, length - string.length); | ||
return padding + string; | ||
} | ||
export function parseFloatRadix(string, radix) { | ||
return parseInt(string.replace('.', ''), radix) | ||
/ Math.pow(radix, (string.split('.')[1] || '').length); | ||
} | ||
export function strRepeat(string, num) { | ||
return new Array(num + 1).join(string); | ||
} |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
690176
55
7305
593