exifreader
Advanced tools
Comparing version 4.18.0 to 4.19.0
{ | ||
"name": "exifreader", | ||
"version": "4.18.0", | ||
"version": "4.19.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:types test test:build", | ||
"pre-commit": "npm-run-all lint test:types coverage test:build", | ||
"postinstall": "node bin/build.js --only-with-config", | ||
@@ -73,3 +73,3 @@ "prepare": "husky install" | ||
"statements": 95, | ||
"branches": 91, | ||
"branches": 90, | ||
"functions": 98, | ||
@@ -76,0 +76,0 @@ "lines": 95, |
@@ -21,13 +21,15 @@ ExifReader | ||
| 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** | | ||
| File type | Exif | IPTC | XMP | ICC | MPF | Photoshop | Thumbnail | Image details | | ||
| ----------|---------|---------|---------|---------|---------|---------------|-----------|---------------| | ||
| JPEG | **yes** | **yes** | **yes** | **yes** | **yes** | **some*** | **yes** | **yes** | | ||
| TIFF | **yes** | **yes** | **yes** | **yes** | ??? | ??? | no | no | | ||
| PNG | **yes** | no | **yes** | no | ??? | ??? | no | **yes** | | ||
| HEIC/HEIF | **yes** | no | no | **yes** | ??? | ??? | no | no | | ||
| WebP | **yes** | no | **yes** | **yes** | ??? | ??? | **yes** | **yes** | | ||
| GIF | no | no | no | no | no | no | no | **yes** | | ||
- ??? = may be supported in any file type using Exif but it has only been tested | ||
- `Image details` = image width, height, etc. read from image header. | ||
- `???` = 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 | ||
- `*` = A draft implementation of Photoshop tags have been added with | ||
`ClippingPathName` and `PathInformation` currently supported. Photoshop tags | ||
@@ -416,2 +418,3 @@ are very different from other tags and need a lot of extra code so they have | ||
| `webp` | WebP images. | | ||
| `gif` | GIF images. | | ||
| `file` | JPEG file details: image width, height etc. | | ||
@@ -521,2 +524,5 @@ | `jfif` | JFIF details in JPEG files: resolution, thumbnail etc. | | ||
- **December 2023**: | ||
- Add support for extracting Photoshop paths. | ||
- Add basic support for GIF images (image dimensions, bit depths). | ||
- **December 2022**: | ||
@@ -523,0 +529,0 @@ - Add option `length` to only read the first `length` bytes of the file. |
@@ -20,3 +20,4 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
USE_HEIC: true, | ||
USE_WEBP: true | ||
USE_WEBP: true, | ||
USE_GIF: true | ||
}; |
@@ -29,2 +29,3 @@ /** | ||
import Vp8xTags from './vp8x-tags.js'; | ||
import GifFileTags from './gif-file-tags.js'; | ||
import Thumbnail from './thumbnail.js'; | ||
@@ -215,2 +216,3 @@ import exifErrors from './errors.js'; | ||
vp8xChunkOffset, | ||
gifHeaderOffset | ||
} = ImageHeader.parseAppMarkers(dataView); | ||
@@ -382,2 +384,12 @@ | ||
if (Constants.USE_GIF && hasGifFileData(gifHeaderOffset)) { | ||
foundMetaData = true; | ||
const readTags = GifFileTags.read(dataView, gifHeaderOffset); | ||
if (expanded) { | ||
tags.gif = !tags.gif ? readTags : objectAssign({}, tags.gif, readTags); | ||
} else { | ||
tags = objectAssign({}, tags, readTags); | ||
} | ||
} | ||
const thumbnail = (Constants.USE_JPEG || Constants.USE_WEBP) | ||
@@ -495,1 +507,5 @@ && Constants.USE_EXIF | ||
} | ||
function hasGifFileData(gifHeaderOffset) { | ||
return gifHeaderOffset !== undefined; | ||
} |
@@ -11,2 +11,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
import Webp from './image-header-webp.js'; | ||
import Gif from './image-header-gif.js'; | ||
import {objectAssign} from './utils.js'; | ||
@@ -39,2 +40,6 @@ | ||
if (Constants.USE_GIF && Gif.isGifFile(dataView)) { | ||
return addFileType(Gif.findOffsets(dataView), 'gif', 'GIF'); | ||
} | ||
throw new Error('Invalid image format'); | ||
@@ -41,0 +46,0 @@ } |
@@ -84,3 +84,3 @@ /* This Source Code Form is subject to the terms of the Mozilla Public | ||
{ | ||
test: /\/(exif-reader|image-header-?(tiff|jpeg|png|heic|webp)?|tags|tag-names)\.js$/, | ||
test: /\/(exif-reader|image-header-?(tiff|jpeg|png|heic|webp|gif)?|tags|tag-names)\.js$/, | ||
loader: 'string-replace-loader', | ||
@@ -110,3 +110,4 @@ options: { | ||
'heic', | ||
'webp' | ||
'webp', | ||
'gif' | ||
]; | ||
@@ -113,0 +114,0 @@ |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
702010
57
7441
599