Commit Graph

363 Commits (208788de28150f1ceba5fbfa2f3fc5f191ac3258)

Author SHA1 Message Date
Dustin Oprea 75b5552112 tags.go: 'Get' functions now take an exifcommon.IfdIdentity 2020-05-24 11:07:46 -04:00
Dustin Oprea 1a12aec48f utility.go: Drop FqIfdPath. Now fully obsolete. 2020-05-20 15:12:04 -04:00
Dustin Oprea 015129a9ef Use RELEASE() notes to denote future backwards-incompatible TODOs 2020-05-20 14:33:28 -04:00
Dustin Oprea 957b817f85 ifd_enumerate.go: Tweak variable name 2020-05-20 14:31:49 -04:00
Dustin Oprea 08ac8466dd ifd.go: Add type system for IFD IDs, names, and paths
This allows us to pass around individual tokens that we can use to
generate IDs, names, and qualified and non-qualified IFD paths, rather
than [necessarily] having to pass or store them individually.

The previous global variables were strings. Now they are IfdIdentity structs
and have been renamed to be more accurate (in general, as well as for this).
The previous variables have been kept but are now just assigned to the newer
variables. This is backwards-compatibility that will be removed in the future.
2020-05-20 14:07:16 -04:00
Dustin Oprea 40de7cc624 ifd.go: Add missing comments 2020-05-20 14:04:00 -04:00
Dustin Oprea 04a4b5ce62 README.md: Move v2 notes to bottom. Add notes about IFD and tag customization. 2020-05-20 01:00:53 -04:00
Dustin Oprea 1b9bb61b5f ifd_enumerate.go: Stop exporting `ParseIfd()` 2020-05-19 03:41:06 -04:00
Dustin Oprea 3cdb59fd80 exif-read-tool: Fix unit-tests and remove unnecessary conditional for 4686c99 2020-05-19 02:47:07 -04:00
Dustin Oprea 753e5191d6 utility.go: Reduce duplication in `GetFlatExifData()` and just use `Scan()` 2020-05-19 02:47:07 -04:00
Dustin Oprea 0f18278742 go.mod: Bugfix for accidental commit 2020-05-19 02:47:06 -04:00
Dustin Oprea 71d0c799d3 Bugfix for some tags failing encoding due to more than one supported type
This was a recently introduced, preexisting bug caused by adding support
for multiple types for certain tags. This suddenly became an issue when
we added all remaining additional types and at least one of these was in
our testing data.
2020-05-19 02:32:43 -04:00
Dustin Oprea 15666b6093 exif-read-tool/main_test.go: Fix usage from tests for go-flags change 2020-05-18 22:37:37 -04:00
Dustin Oprea 76635a8c89 utility.go: Bugfix for excessive loading and reloading of tag-indices 2020-05-18 01:23:35 -04:00
Dustin Oprea 4686c99e3c exif-read-tool/main.go: Just use GetFlatExifData() instead of our own visitor process 2020-05-18 01:16:27 -04:00
Dustin Oprea 8e727e3388 ifd_enumerate.go: We now log the approximate size of the EXIF blob 2020-05-18 01:15:29 -04:00
Dustin Oprea af2e8222eb utility.go: ExifTag now has UnitCount field 2020-05-18 01:14:56 -04:00
Dustin Oprea 7aa41d6d0d ifd_enumerate.go: Add missing comments 2020-05-18 00:50:10 -04:00
Dustin Oprea 6629fe3012 tags.go: Tweak tag-registration logging verbiage 2020-05-18 00:21:25 -04:00
Dustin Oprea 4857cb0b30 exif-read-tool/main.go: Can now suppress the tag output 2020-05-18 00:12:54 -04:00
Dustin Oprea e1d21a3716 exif-read-tool/main.go: Use go-flags for command-line processing 2020-05-18 00:09:14 -04:00
Dustin Oprea d0d0f14dea tags_data.go: FNumber and ExposureTime can now be decoded if SRATIONAL 2020-05-17 20:16:53 -04:00
Dustin Oprea 29b0ff2256 tags_data.go: Bugfix for some standard tags being ignored 2020-05-17 19:41:48 -04:00
Dustin Oprea d2495e29dd utility.go: Skip unknown tags in GetFlatExifData
This makes its behavior consistent with other iteration/enumeration
functions and also mitigates handling errors by unsuspecting callers.
2020-05-17 19:40:38 -04:00
Dustin Oprea 232d5acc36 ifd_enumerate.go: Log that the thumbnail tags were found but being handled elsewhere
This might mitigate confusion since they are, technically, present.
2020-05-17 19:39:26 -04:00
Dustin Oprea 13045756c5 go.mod: Bump go-logging
- Bring in Is() changes.
2020-05-17 19:36:03 -04:00
Dustin Oprea c9be4b30b0 tags.go: TagIndex now supports multiple types for a single tag
Apparently PixelXDimension and PixelYDimension can official be a SHORT
*or* a LONG, and, now that we're skipping anything that doesn't agree
with the index, it broke some tests.
2020-05-17 04:05:29 -04:00
Dustin Oprea 3310e4b8c8 ifd_enumerate.go: Skip tags that have a divergent type
This also mitigates the processing of duplicate tags (which should never
occur) if the duplicate tags also happen to have unexpected types (our
current scenario).

2020/05/17 02:26:37 exif.ifd_enumerate: [DEBUG]  IFD [IFD/GPSInfo] tag-count: (10)
2020/05/17 02:26:37 exif.ifd_enumerate: [WARNING]  Skipping tag [IFD/GPSInfo] (0x0005) [GPSAltitudeRef] with an unexpected type: (5) [RATIONAL] != (1) [BYTE]
2020/05/17 02:26:37 exif.ifd_enumerate: [WARNING]  Skipping tag [IFD/GPSInfo] (0x001b) [GPSProcessingMethod] with an unexpected type: (2) [ASCII] != (7) [UNDEFINED]
2020/05/17 02:26:37 exif.ifd_enumerate: [DEBUG]  Next IFD at offset: (00000000)

Fixes #37
2020-05-17 02:29:36 -04:00
Dustin Oprea e1b21b5186 tags.go: (TagIndex).Get() now returns ErrTagNotFound rather than panics
This is a managed error scenario.

- Added missing comments.
2020-05-17 02:28:17 -04:00
Dustin Oprea 998844ba08 ifd_enumerate.go: PrintTagTree now skips the thumbnail tags
It prints a lot of noise when this does actually relate to saving the
thumbnail image.
2020-05-17 01:28:11 -04:00
Dustin Oprea 7f6eb3d9f3 utility.go: Add formatted values to ExifTag 2020-05-16 17:31:02 -04:00
Dustin Oprea 220964731d ifd_enumerate.go: Bugfix for ITEs not representing fully-qualified IFD paths
- This resulted in the lookup table having unique entries, and therefore
  no longer needing its values to be slices. We are going to fix this.
  It is not a backwards-compatible change, but this is a fairly internal
  internal functionality.

- Add simple accessors to determine if a thumbnail offset or size.
2020-05-16 17:18:57 -04:00
Dustin Oprea efa6e2d6c0 ifd_builder_test.go: Fix test 2020-05-16 16:47:03 -04:00
Dustin Oprea a45cc7cfd5 exif-read-tool/main.go: Example tool can now dump the thumbnail 2020-05-16 08:21:16 -04:00
Dustin Oprea 71e87d5e22 ifd_enumerate.go:
- Invalid tag-type sets the tag-ID so that we can include it in the log.
- Other logging enhancements.
  - Removed newline

- Incorporate the thumbnail into the furthest-offset counter.
- Thumbnail() no longer panics ErrNoThumbnail and just returns it.
  - This is a managed error, not a true panic condition.

- Collect() now builds index with FQ IFD paths, not non-FQ.
2020-05-16 08:21:12 -04:00
Dustin Oprea 70b6dc8a1a utility.go: Bugfix for non-FQ IFD-paths in GetFlatExifData 2020-05-16 07:54:40 -04:00
Dustin Oprea 42546383ce ifd_enumerate.go: Bugfix for slice error when processing thumbnails
We were not qualifying our thumbnail tag checks with the IFD that
thumbnails are supposed to live in, and were trying to parse the tags
that happen to share the same tag-IDs as thumbnails.

Fixes #dsoprea/go-jpeg-image-structure/issues/10
2020-05-16 07:32:13 -04:00
Dustin Oprea 5e5d4dcef0 ifd_builder_test.go: Fix inaccurate error message 2020-05-16 06:43:09 -04:00
Dustin Oprea 95ec440155 ifd_enumerate.go: Bugfix for scan() fully-qualified IFD paths not being fully-qualified 2020-05-16 06:42:42 -04:00
Dustin Oprea 86f0767752 ifd.go: Drop old commented IfdIdentity type 2020-05-16 06:38:39 -04:00
Dustin Oprea f50c93b99c common: Rename exif.go to ifd.go 2020-05-16 05:24:33 -04:00
Dustin Oprea 9bcc8a45c4 Provide EXIF blob size estimates
We now keep track of the further offset that we have accessed (though
not necessarily the furthest offset of data that is unparseable by us).

It sometimes supports debugging efforts to have a ballpark idea of how
much EXIF data there is, rather than just "from the signature to the
end of the file" or however big the EXIF container is in the enclosing
image format. The latter can be buggy or ambiguous.
2020-05-16 03:19:52 -04:00
Dustin Oprea 416fd86ecd ifd_enumerate.go: Rename IfdTagEnumerator to byteParser
It's more accurate, and no longer exported.
2020-05-16 02:51:36 -04:00
Dustin Oprea 5fdad87477 exif-read-tool/main.go: Log size of EXIF blob
Remember that this is typically from the EXIF signature to the end of
the file.
2020-05-16 01:46:26 -04:00
Dustin Oprea 687250767b ifd_enumerate.go: Drop spurious struct field. Put hex prefix on offset in logging. 2020-05-16 01:45:36 -04:00
Dustin Oprea 3ed898edc8 exif.go: Log offset in SearchAndExtractExifWithReader() 2020-05-16 01:44:15 -04:00
Dustin Oprea 5c21ae7376 ifd_enumerate.go: Enrich unknown-type error with type number 2020-05-16 01:03:31 -04:00
Dustin Oprea 9ce7f5d058 ifd_enumerate.go: Fix log subject 2020-05-16 00:52:14 -04:00
Dustin Oprea e7aea1340c ifd_enumerate.go: Tweak log message 2020-05-06 04:59:28 -04:00
Dustin Oprea 86feeb2b50 ifd_enumerate.go: Log and quietly stop parsing if IFD offset is invalid
Fixes #36
2020-05-06 04:56:05 -04:00