Skip to content

Commit ec1bb18

Browse files
authored
Merge pull request #72 from cinema-ONE/tinyexif-resync
Update vendored TinyEXIF to 8c22aff
2 parents e21a0e7 + 33a19e1 commit ec1bb18

4 files changed

Lines changed: 870 additions & 256 deletions

File tree

lib/TinyEXIF/README.md

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -34,24 +34,49 @@ int main(int argc, const char** argv) {
3434
```
3535
See `main.cpp` for more details.
3636

37-
## Copyright
38-
39-
Redistribution and use in source and binary forms, with or without
40-
modification, are permitted provided that the following conditions are met:
41-
42-
- Redistributions of source code must retain the above copyright notice,
43-
this list of conditions and the following disclaimer.
44-
- Redistributions in binary form must reproduce the above copyright notice,
45-
this list of conditions and the following disclaimer in the documentation
46-
and/or other materials provided with the distribution.
47-
48-
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ``AS IS'' AND ANY EXPRESS
49-
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
50-
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
51-
NO EVENT SHALL THE FREEBSD PROJECT OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
52-
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
53-
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
54-
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
55-
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
56-
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
57-
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
37+
## Absent tags vs tags that are legitimately zero
38+
39+
All data fields are zero-initialised, so a value of `0` on its own does not say whether the tag
40+
was missing from the file or whether the camera really wrote a `0`. `HasField()` answers that,
41+
and `GetFields()` lists everything that was found:
42+
43+
```
44+
TinyEXIF::EXIFInfo imageEXIF(istream);
45+
46+
// ISOSpeedRatings == 0 alone is ambiguous, this is not
47+
if (imageEXIF.HasField(TinyEXIF::FIELD_ID_ISOSpeedRatings))
48+
std::cout << "ISO " << imageEXIF.ISOSpeedRatings << "\n";
49+
else
50+
std::cout << "ISO not recorded by the camera\n";
51+
52+
// list every tag that was present
53+
for (TinyEXIF::FieldID id: imageEXIF.GetFields())
54+
std::cout << TinyEXIF::FieldName(id) << "\n";
55+
```
56+
57+
There is one `FieldID` enumerator per data field, named `FIELD_ID_` followed by the path of the
58+
member it fills, e.g. `FIELD_ID_GeoLocation_Altitude` for `GeoLocation.Altitude`; `FieldName()`
59+
returns that path as a string. A field counts as present when the tag carrying it was parsed
60+
successfully, from EXIF or from XMP; a tag that is present but malformed does not count.
61+
Existing fields, sentinel values (`DBL_MAX`, `UINT32_MAX`) and `hasXxx()` accessors are
62+
unchanged, so this is purely additive.
63+
64+
Run the demo with `TinyEXIFdemo <image_file> --fields` to print the list for a file.
65+
66+
This API was added in 1.1.0 and can be feature-gated with the `TINYEXIF_VERSION` macro:
67+
68+
```
69+
#if TINYEXIF_VERSION >= 10100
70+
// TinyEXIF::EXIFInfo::HasField() is available
71+
#endif
72+
```
73+
74+
## License
75+
76+
MIT [License](https://github.com/cdcseacave/TinyEXIF/blob/master/LICENSE)
77+
78+
Copyright (c) 2025 cdcseacave
79+
80+
## Acknowledgments
81+
82+
Forked from [easyexif](https://github.com/mayanklahiri/easyexif) library (2013 version) of Mayank Lahiri (mlahiri@gmail.com); see [LICENSE.easyexif](https://github.com/cdcseacave/TinyEXIF/blob/master/LICENSE.easyexif) for its terms.

0 commit comments

Comments
 (0)