Code Monkey home page Code Monkey logo

Comments (10)

mattiasw avatar mattiasw commented on July 28, 2024

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.

BuZZ-dEE avatar BuZZ-dEE commented on July 28, 2024

@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.

BuZZ-dEE avatar BuZZ-dEE commented on July 28, 2024

@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.

mattiasw avatar mattiasw commented on July 28, 2024

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.

BuZZ-dEE avatar BuZZ-dEE commented on July 28, 2024

@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.

mattiasw avatar mattiasw commented on July 28, 2024

[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.

BuZZ-dEE avatar BuZZ-dEE commented on July 28, 2024

@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.

mattiasw avatar mattiasw commented on July 28, 2024

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.

BuZZ-dEE avatar BuZZ-dEE commented on July 28, 2024

@mattcg could you implement a function that provides this?

from exifreader.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.