September 6th, 2012, 01:40 PM
Adding GPS data to JPEG file
This is not strictly a C++ question, but I don't know where else to ask!
Anyway, I am writing a program to read and write EXIF data in a JPEG file; specifically, the GPS data.
I have managed to successfully write code that reads the GPS data. Also, if the GPS data already exists in the file, I have successfully written code to edit that data.
However, what I am having trouble with is how to edit GPS data, if it does not already exists in the file. In this case, I have to actually create the GPS field in the IFD0 section because it does not already exist. I know how to do this. However, contained in this field is a pointer to the actual GPS data (e.g. longitude, latitude...), and what I am not sure of is where to actually write this data.
I have noticed that there are loads of zeros in a JPEG file, between the IFD0 and all the data it has pointers to. I guess that I could just write my GPS data into this space, and point to it in the IFD0. But is this the proper way to do this, or should I put the data elsewhere?
Thanks for any help!
Click Here to Expand Forum to Full Width