Comments (10)
Hi! You can get the "raw"/not parsed value of a tag by reading value
. If that is what you mean. The tag ID is not available though.
from exifreader.
@mattiasw I need all exif values and each exif value I need to get the by the property "Tag (dec)", because the backend reads the exif values by the "Tag (dec)".
from exifreader.
@mattiasw For example: https://mutiny.cz/exifr
const exifrData = exifr.parse(fileBuffer, {exif: true, reviveValues: false, translateKeys: false, translateValues: false}).then((values) => {
console.log('exifr', values);
});
Result:
{
"0": <Uint8Array 02 02 00 00>,
"1": "N",
"2": [50, 17, 58.57],
"3": "E",
"4": [14, 49, 13.06],
"5": <Uint8Array 00>,
"6": 252,
"7": [14, 34, 23],
"11": 18,
"27": <Uint8Array 41 53 43 49 49 00 00 00 66 75 73 65 64>,
"29": "2018:07:25",
"256": 4048,
"257": 3036,
"271": "Google",
"272": "Pixel",
"274": 1,
"282": 72,
"283": 72,
"296": 2,
"305": "HDR+ 1.0.199571065z",
"306": "2018:07:25 16:34:23",
"531": 1,
"33434": 0.000376,
"33437": 2,
"34665": 239,
"34850": 2,
"34853": 18478,
"34855": 50,
"36864": <Uint8Array 30 32 32 30>,
"36867": "2018:07:25 16:34:23",
"36868": "2018:07:25 16:34:23",
"37121": <Uint8Array 01 02 03 00>,
"37377": 11.38,
"37378": 2,
"37379": 9.38,
"37380": 0,
"37381": 2,
"37382": 0.892,
"37383": 2,
"37385": 16,
"37386": 4.67,
"37520": "935476",
"37521": "935476",
"37522": "935476",
"40960": <Uint8Array 30 31 30 30>,
"40961": 1,
"40962": 4048,
"40963": 3036,
"40965": 18448,
"41495": 2,
"41729": 1,
"41985": 1,
"41986": 0,
"41987": 0,
"41988": 0,
"41989": 26,
"41990": 0,
"41992": 0,
"41993": 0,
"41994": 0,
"41996": 1,
"latitude": 50.29960277777778,
"longitude": 14.820294444444444
}
from exifreader.
There is (currently) no parameter to pass in for that but it can be done afterwards. Here is a oneliner that also fixes that strings in their raw format comes in an array. You may want to split this up for better readability. :-)
const tags = await ExifReader.load('/path/to/image.jpg', {expanded: true});
console.log(Object.fromEntries(Object.entries(tags.exif).map(([key, value]) => ([value.id, Array.isArray(value.value) && value.value.length === 1 && typeof value.value[0] === 'string' ? value.value[0] : value.value]))));
from exifreader.
@mattiasw we already tried that, but we get not the result we need.:
{
"1": "N",
"2": [
[53, 1],
[15, 1],
[4194, 100]
],
"3": "E",
"4": [
[7, 1],
[55, 1],
[3645, 100]
],
"5": 0,
"6": [47629, 5606],
"7": [
[9, 1],
[56, 1],
[5326, 100]
],
"12": "K",
"13": [0, 1],
"16": "T",
"17": [366457, 2469],
"23": "T",
"24": [366457, 2469],
"29": "2024:05:30",
"31": [53285, 6253],
"271": "Apple",
"272": "iPhone 13 mini",
"274": 6,
"282": [72, 1],
"283": [72, 1],
"296": 2,
"305": "17.4.1",
"306": "2024:05:30 11:56:59",
"316": "iPhone 13 mini",
"33434": [1, 50],
"33437": [8, 5],
"34665": 228,
"34850": 2,
"34853": 2542,
"34855": 160,
"36864": [48, 50, 51, 50],
"36867": "2024:05:30 11:56:59",
"36868": "2024:05:30 11:56:59",
"36880": "+02:00",
"36881": "+02:00",
"36882": "+02:00",
"37377": [50493, 8947],
"37378": [14447, 10653],
"37379": [36931, 18383],
"37380": [0, 1],
"37383": 5,
"37385": 16,
"37386": [51, 10],
"37396": [1968, 1487, 2320, 1324],
"37521": "070",
"37522": "070",
"40961": 65535,
"40962": 4032,
"40963": 3024,
"41495": 2,
"41729": 1,
"41986": 0,
"41987": 0,
"41988": [3024, 593],
"41989": 130,
"42034": [
[807365, 524263],
[51, 10],
[8, 5],
[12, 5]
],
"42035": "Apple",
"42036": "iPhone 13 mini back dual wide camera 5.1mm f/1.6",
"42080": 2
}
The problem for example is:
"282": [72, 1],
we need the computed value like it is in exifr and blueimp/JavaScript-Load-Image:
282: 72,
Is that possible?
from exifreader.
[72, 1]
is a very close representation of the raw data from the file. It's a rational number which is represented by numerator and denominator. So to get the actual number you can divide the first one with the second one. In this case that is 72
since the denominator happens to be 1.
from exifreader.
@mattiasw when do I know that I can calculate the values in this way? As far as I know the values could in the array could have another meaning, for example they could represent ascii values?
from exifreader.
Yeah, it's tricky I'm afraid. In ExifReader there is only the original representation or the computed value as in description
, nothing in between where only some tag values are transformed. I guess the back end knows the tag types? Maybe that would be required, to change that too.
from exifreader.
@mattcg could you implement a function that provides this?
from exifreader.
Related Issues (20)
- Exception is thrown when reading tags from an image HOT 5
- Possible to add support for protocols other than http? Or bypass to allow another protocol? HOT 3
- Custom build failures for Yarn Berry HOT 2
- Custom build installs excessive dependencies HOT 5
- (Not An Issue) How to remove metadata and Update the buffer HOT 1
- Typescript types for GIF support HOT 2
- Webpack error when attemping to use custom build HOT 3
- Incorrect exposure time reported for description HOT 9
- Newbie question: why are scalar exif properties (like DateTimeOriginal and most others) returned as string arrays? HOT 3
- Feature request: AVIF format HOT 5
- Feature Request: Support for MOV, MP4, etc HOT 1
- exif-reader.d.ts's NumberArrayTag type for GPSLatitude & GPSLongitude should be number[][] rather than number[] HOT 1
- Error with image in AVIF format HOT 1
- The width and height of the image are incorrectly obtained HOT 1
- Lens model doesn't seem to be parsed correctly HOT 8
- How to extract metadata from HTMLImageElement? HOT 2
- fileExif.exif.GPSLatitude value vs description HOT 2
- lens_specification read value overflow HOT 2
- `zTXt` tag values are decoded incorrectly HOT 7
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from exifreader.