-
-
Notifications
You must be signed in to change notification settings - Fork 89
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to get raw exif data? #330
Comments
Hi! You can get the "raw"/not parsed value of a tag by reading |
@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)". |
@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
} |
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])))); |
@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:
we need the computed value like it is in exifr and blueimp/JavaScript-Load-Image:
Is that possible? |
|
@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? |
Yeah, it's tricky I'm afraid. In ExifReader there is only the original representation or the computed value as in |
@mattcg could you implement a function that provides this? |
I guess you meant to tag me. Maybe one way could be to add the type to the tag object. Would that help you? |
How can I get the raw exif data from the image file in the format like the following?:
Is that possible?
The text was updated successfully, but these errors were encountered: