Extracting Exif Data

Discussion in 'Questions (Windows Mobile)' started by jesb4ppc, Feb 13, 2008.

  1. jesb4ppc

    jesb4ppc Member Licensed User

    Hi everyone,

    I'm wondering if it's possible to extract and use the exif data from a .JPG file. I guess that opening the .jpg file in byte mode will be the first approching, but is there any function/object/dll or something to do it?

    Thanks in advance,

    Jes.
     
  2. Erel

    Erel Administrator Staff Member Licensed User

    It is possible to do it using the BinaryFile.
    The Exif raw format is pretty complicated so it is not an easy task.
    There is no built-in function that does it.
     
  3. jesb4ppc

    jesb4ppc Member Licensed User

    Exif

    Ok. thank you.
     
  4. tigme

    tigme New Member Licensed User

    I have done a similar thing extracting IPTC data from JPEG reading the file in binary with PHP4 and then do a search for tags to find the Caption of a photo created in Photoshop (for example). So theoretically finding EXIF would be same.

    What I would like to know is:

    Does anybody have some advice writing your own IPTC/EXIF data into a JPEG. I'm developing an App where the client can edit upload his pics and then FTP them as needed.

    I want to do an FTP Client in B4PPC that can resize/ftp JPEG to an FTP server...
     
    Last edited: Feb 17, 2008
  5. maXim

    maXim Active Member Licensed User

    Hi jesb4ppc,

    Look the Thread "db2000 - JPEG Exif" in "Italian Forum"...
    Full Basic4ppc OpenSource! :)

    Best Regards.

    maXim
     
  6. Erel

    Erel Administrator Staff Member Licensed User

  7. HARRY

    HARRY Active Member Licensed User

    Hi,

    Quite some time ago I have written in Visual Basic some routines to extract data from a JPEG file: the date a photo was made; the width and the height.

    Today, thanks to the excellence of Basic4PPC and the support organization, I have made the same functionality in Basic4PPC.

    Attached you will find the demonstration program, containing two routines. It is eay to incorporate those routines in another program: the interface is just a call with the filename and a structure to receive the data. Another structure is required for the routines.

    For those who require other information to extract, on http://www.exif.org/Exif2-2.PDF you will find the codes for all other information. Adding Manufacturer and Model took me a quarter of an hour.

    The JFIF format is not (yet) supported; if some body would like that to be supported, please let me know.

    Harry

    Harry
     

    Attached Files:

  8. Erel

    Erel Administrator Staff Member Licensed User

    Great job HARRY!
     
  9. maXim

    maXim Active Member Licensed User

    Hi Harry,

    I see with pleasure Your interest to the Exif data! I would like to exchange the experiences but there is only a problem: I don't know very the language English :(... You know Italian language? (also few little) ;)

    Best Regards.

    maXim
     
  10. jesb4ppc

    jesb4ppc Member Licensed User

    Thank You

    Thank you very much to you all, specially maXim and Harry.

    That's another side of basic4ppc. Is not only the tool itself, but also the people around it.

    Thank you again.:)
     
  11. HARRY

    HARRY Active Member Licensed User

    Hallo Maxim,

    Sorry, but I don't speak, read or write Italian. Dutch by preference, English, German and somewhat French is also OK. I tried to read your Italian article , but I do not understand the clue.

    Harry
     
  12. maXim

    maXim Active Member Licensed User

    Hi HARRY,

    Sig! :(

    Well, if You agree, I will communicate in English with the hope not to commit many errors...

    Which other experiences have You done in Exif data management?

    Best Regards

    maXim
     
  13. RandomCoder

    RandomCoder Well-Known Member Licensed User

    To overcome the communication problem you could try using Microsoft Word to translate, tools>language>transulate.

    Per superare il problema che di comunicazione potreste provare usando il Microsoft Word per tradurre, tools>language>transulate.

    Its not 100% reliable but might just help (normally I translate into the language I want and then back to English to see that it hasn't screwed up)

    Regards,
    RandomCoder
     
  14. HARRY

    HARRY Active Member Licensed User

    Hi,

    Quite some time ago I posted sample code tot extract EXIF data from a JPEG file.

    Recently I found myself two errers in that code:

    1) Some manufacturers of camera devices store values in the EXIF data with the Least Significant Byte first, others with the Most Significant Byte first. This was not covered in my sample.

    2) Values of less than 5 bytes will be stored in the OffSet field itself, in stead of the OffSet fields indicating an offset to the place where that data is stored. E.g the manufacturer name HTC will be stored in the offset field itself.

    In my sample code this was not always covered.

    I found these problems after buying another camera.

    For those interested I have attached the improved sample code.

    Harry
     

    Attached Files:

  15. ihatton

    ihatton Member Licensed User

    Harry,

    Thanks for posting this sample application. I am interested in accessing the GPS co-ordinates which can be included in the EXIF header (in order to geotag a photo) and wondered if you have already implemented this in a newer version of your code?

    Best Regards,
    Ian Hatton
     
  16. HARRY

    HARRY Active Member Licensed User

    Hallo ihatton,

    No, I didn't include GPS data in my code. If you still need it, I will try to do so. Please let me know.

    Harry
     
  17. HARRY

    HARRY Active Member Licensed User

    Hallo ihatton,

    Meanwhile I finished the code to extract latitude, longitude and altitude from the EXIF data. However, I have problems in testing it as I have myself only two images with GPS data. Could you mail me some more images with GPS data, indicating as far as possible the location where these pictures were taken?

    Harry
     
  18. ihatton

    ihatton Member Licensed User

    Hi Harry,

    Sorry for the delayed response. The attached zip file contains some JPEG samples with GPS data in the EXIF header. I also included the PC command line utility jhead.exe which will display the EXIF header data for cross checking purposes.

    Best Regards,
    Ian Hatton
     
  19. HARRY

    HARRY Active Member Licensed User

    Hi Ian,

    Meanwhile I finished the work. Attached you will find the code of the test program, the module that does the extraction and a compiled demonstration program.

    The test program includes a own made module to select a file. This module allows to select sub directories as much as you want, which is not possible on the device with the OpenDialog component.

    Some explanation: the selection starts from the C:\ disk on the PC or from \ on the device. Directories are marked with "D", files with "F". Click on a "D" line to see lower level directories or files. Click on a "F" line to select that file. With the left button you go to a higher level, if available; with the right button the selection process is cancelled.

    I found a program (Resco Photo Manager) on internet to add coordinates to a EXIF file; so I could test the extraction much better.

    The files you have sent me are JFIF files; so I could not use them for testing. I learned from internet that some programs handling images change a file with EXIF data into a file with JFIF data.

    Good luck. If there are any problems, please inform me,

    Harry
     
  20. agraham

    agraham Expert Licensed User

Loading...