Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. Reading EXIF data from image
Forum Updated to NodeBB v4.3 + New Features

Reading EXIF data from image

Scheduled Pinned Locked Moved QML and Qt Quick
2 Posts 2 Posters 6.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    strekazoid
    wrote on 16 Nov 2010, 13:38 last edited by
    #1

    Hey. I'm trying this useful javascript for reading EXIF data from my image:
    http://blog.nihilogic.dk/2008/05/reading-exif-data-with-javascript.html

    However I'm not able to pass the image argument into the script from QML. Just keep getting warnings like this:

    simple_one.qml:30: TypeError: Result of expression 'EXIF.getTag' [undefined] is not a function.

    Here is how I try to do it:

    @import "exif.js" as EXIF
    ...
    Image {
    id: image1
    x: 231
    y: 120
    width: 196
    height: 125
    fillMode: Image.Stretch
    source: "photos/12092009401.jpg"
    }

    Text {
    id: text1
    x: 165
    y: 366
    width: 80
    height: 20
    color: "#ffffff"
    text: EXIF.getTag("photos/12092009401.jpg", "Model")
    font.pointSize: 20
    }
    @

    Seems that the argument of image should be passed to the exif.js in some other way. Any ideas what I'm doing wrong here?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mutaphysis
      wrote on 17 Nov 2010, 17:18 last edited by
      #2

      The values exported from exif.js are put on a global object named EXIF (incidentally the same as your import). In a normal browser environment you would access them by using EXIF.Tags, EXIF.getTag etc.
      But in QML javascript globals are imported into their own namespace (in your case also EXIF).
      So anything declared on the global context inside the exif.js is available on that additional EXIF object.

      So - to make complicated things short:

      To access your functions you have to call @EXIF.EXIF.getTag@.

      You could also change exif.js and remove the closure and have all the functions and constants directly on the global context.

      1 Reply Last reply
      0

      1/2

      16 Nov 2010, 13:38

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved