Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Exif tags

Exif tags

Scheduled Pinned Locked Moved General and Desktop
10 Posts 6 Posters 13.3k Views
  • 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.
  • J Offline
    J Offline
    Jzz5
    wrote on last edited by
    #1

    Hi all,

    I'm kinda new to Qt and I'm trying to read (and possibly write) Exif tags from JPG's. Several googles didn't give me any answers, so I'm trying here. Does anyone have any ideas or possibly even a small example how to do this?

    I'm using Qt 4.7

    Thanks!

    Jzz

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tony
      wrote on last edited by
      #2

      Hi,

      you can read EXIF information with "libexif":http://libexif.sourceforge.net

      In the sources you'll find also some examples.

      T.

      1 Reply Last reply
      0
      • D Offline
        D Offline
        dfaure
        wrote on last edited by
        #3

        If this is for an opensource program, you can use libkexiv2 which wraps libexif with a Qt-based API.

        http://websvn.kde.org/trunk/KDE/kdegraphics/libs/libkexiv2/

        David Faure (david.faure@kdab.com)
        KDE/Qt Senior Software Engineer
        KDAB - Qt Experts - Platform-independent software solutions

        1 Reply Last reply
        0
        • J Offline
          J Offline
          jsiei97
          wrote on last edited by
          #4

          Normally you use QImage.setText(key,value) to do this,
          but I think it is missing for jpeg.

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jzz5
            wrote on last edited by
            #5

            Oh, but I'm not really limited to jpg. What image format would you use then?

            A little background perhaps... I'm trying to build a chartplotter (for nautical navigation) so I need charts. I draw rectangles with the images as brush. So I need to know for each image what the size is and the scale. That's where the Exif tags come in. But I'm free to choose the image format myself, I need to scan the paper charts.

            Any ideas?
            Jzz

            1 Reply Last reply
            0
            • S Offline
              S Offline
              serkol
              wrote on last edited by
              #6

              I use file "qexifimageheader" to read EXIF tags. I've copied it from Qt sources some time ago. I don't remember the exact Qt version that I copied it from. A note in the file reads "Qt Extended 4.5". Before that I was using a 3rd party lib - it was very slow. qexifimageheader is very fast.

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jsiei97
                wrote on last edited by
                #7

                Have a try with png, I know that you can add text to png img (but I'm not sure what kind of limitations you will face with png thou). It could be worth a try.

                1 Reply Last reply
                0
                • B Offline
                  B Offline
                  blex
                  wrote on last edited by
                  #8

                  [quote author="Jzz5" date="1290883262"]So I need to know for each image what the size is and the scale[/quote]

                  Maybe I do not understand the question correctly, but image size is returned by

                  @
                  QImage::size()
                  @

                  You may scale image to any dimensions using

                  @
                  QImage::scaled()
                  @


                  Oleksiy Balabay

                  1 Reply Last reply
                  0
                  • J Offline
                    J Offline
                    Jzz5
                    wrote on last edited by
                    #9

                    Thanks for the usefull feedback!

                    I will look into the solution posted by Serkol, it looks promising.

                    @Sekol: I should have stated this more clearly I think, the scale and size I'm talking about are those of the chart itself, not that of the image.

                    1 Reply Last reply
                    0
                    • S Offline
                      S Offline
                      serkol
                      wrote on last edited by
                      #10

                      Jzz5, since you will save your exif info into your files, it's up to you what to save there. You should use one of standard exif tags, but you can write whatever you want there.

                      I've glanced at qexifimageheader - it looks like it supports only jpeg. It can read and write exif info.

                      blex: say you have 1000 images, each of them is a few MB, and you need to read some info from all these files. When you load an image into QImage, you load the whole file - this is too slow in many cases. When you read exif info, you read just a few bytes from the file, yuou don't have to load the whole file into memory.

                      1 Reply Last reply
                      0

                      • Login

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