Exif tags



  • 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



  • Hi,

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

    In the sources you'll find also some examples.

    T.



  • 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/



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



  • 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



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



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



  • [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()
    @



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



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


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.