Skip to content

Commit c46c203

Browse files
committed
Misc. improvements
* Implement EXIF and IPTC for TIFF files * Impolement IPTC support for PNG files * Improve IPTC type handling * Replace the use of io.NewSectionReader with a pooled buffered reader; much more effective for short reads, just as fast for longer reads. * The above also makes the API simpler as the provided Reader does not have to support io.ReaderAt
1 parent 64026eb commit c46c203

File tree

185 files changed

+3215
-468
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

185 files changed

+3215
-468
lines changed

‎.gitignore‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616

1717
.DS_Store
1818

19-
dump.html
19+
dump.html
20+
dump.txt

‎README.md‎

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
[![codecov](https://codecov.io/gh/bep/imagemeta/branch/main/graph/badge.svg)](https://codecov.io/gh/bep/imagemeta)
44
[![GoDoc](https://godoc.org/github.com/bep/imagemeta?status.svg)](https://godoc.org/github.com/bep/imagemeta)
55

6+
> [!CAUTION]
7+
> This library is still a work in progress, and I would wait until it's merged into Hugo before consider using it or open issues/PRs about it.
8+
69
## This is about READING image metadata
710

811
Writing is not supported, and never will.
@@ -42,6 +45,10 @@ The output of this library is tested against `exiftool -n -json`. This means, fo
4245
* IPTC field definitions are fetched from this table: https://exiftool.org/TagNames/IPTC.html
4346
* The XMP handling is currently very simple, you can supply your own XMP handler (see the `HandleXMP` option) if you need more.
4447

48+
There are some subtle differences in output:
49+
50+
* Exiftool prints rationale number arrays as space formatted strings with a format/precision that seems unnecessary hard to replicate, so we use `strconv.FormatFloat(f, 'f', -1, 64)` for these.
51+
4552
## Development
4653

4754
Many of the tests depends on generated golden files. To update these, run:
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2004-01-11-22-45-15-sep-2004-01-11-22-45-15a.jpg",
2+
"SourceFile": "../testdata/goexif/2004-01-11-22-45-15-sep-2004-01-11-22-45-15a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2004-01-11-22-45-15-sep-2004-01-11-22-45-15a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 4586,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2006-08-03-16-29-38-sep-2006-08-03-16-29-38a.jpg",
2+
"SourceFile": "../testdata/goexif/2006-08-03-16-29-38-sep-2006-08-03-16-29-38a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2006-08-03-16-29-38-sep-2006-08-03-16-29-38a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 9735,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2006-11-11-19-17-56-sep-2006-11-11-19-17-56a.jpg",
2+
"SourceFile": "../testdata/goexif/2006-11-11-19-17-56-sep-2006-11-11-19-17-56a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2006-11-11-19-17-56-sep-2006-11-11-19-17-56a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 35406,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2006-12-10-23-58-20-sep-2006-12-10-23-58-20a.jpg",
2+
"SourceFile": "../testdata/goexif/2006-12-10-23-58-20-sep-2006-12-10-23-58-20a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2006-12-10-23-58-20-sep-2006-12-10-23-58-20a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 8711,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2006-12-17-07-09-14-sep-2006-12-17-07-09-14a.jpg",
2+
"SourceFile": "../testdata/goexif/2006-12-17-07-09-14-sep-2006-12-17-07-09-14a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2006-12-17-07-09-14-sep-2006-12-17-07-09-14a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 38252,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2006-12-21-15-55-26-sep-2006-12-21-15-55-26a.jpg",
2+
"SourceFile": "../testdata/goexif/2006-12-21-15-55-26-sep-2006-12-21-15-55-26a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2006-12-21-15-55-26-sep-2006-12-21-15-55-26a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 16072,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2007-01-01-12-00-00-sep-2007-01-01-12-00-00a.jpg",
2+
"SourceFile": "../testdata/goexif/2007-01-01-12-00-00-sep-2007-01-01-12-00-00a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2007-01-01-12-00-00-sep-2007-01-01-12-00-00a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 17301,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
[{
2-
"SourceFile": "../testdata/goexif_samples/2007-01-17-21-49-44-sep-2007-01-17-21-49-44a.jpg",
2+
"SourceFile": "../testdata/goexif/2007-01-17-21-49-44-sep-2007-01-17-21-49-44a.jpg",
33
"ExifTool": {
44
"ExifToolVersion": 12.76,
55
"Warning": "JPEG format error"
66
},
77
"File": {
88
"FileName": "2007-01-17-21-49-44-sep-2007-01-17-21-49-44a.jpg",
9-
"Directory": "../testdata/goexif_samples",
9+
"Directory": "../testdata/goexif",
1010
"FileSize": 7999,
1111
"FilePermissions": 100644,
1212
"FileType": "JPEG",

0 commit comments

Comments
 (0)