Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Libexif , appending new exif data

Tags:

c++

c

jpeg

libexif

I have a task to edit exif tags and add to them application specific values. if the exif tags exist libexif is more than happy to edit them . but if the exif tags don't exist, i will have to create them and append them to file. libexif uses the C fopen so i don't think there is going to be an easy way without some IO manipulation. I am thinking to read the raw image data put them in memory , fopen(newfile, 'w') add the exif data and then append the image data.
only if someone knows an easier way , ( i am restricted with libexif, libexiv2 might create a liscence conflict) .

like image 861
Nadim Farhat Avatar asked Aug 21 '12 13:08

Nadim Farhat


1 Answers

for the common good i am going to answer my own question, exif application has a modified libjpeg that enable the manipulation of the jpeg raw data. it has functions like

jpeg_data_load_data (JPEGData *data, const unsigned char *d,unsigned int size); and

jpeg_data_set_exif_data(myJPEGImage,exif); jpeg_data_save_file(myJPEGImage,"gangrene1.jpg");

That can be used, also free available programs like imagemagick have their own libjpeg , libexif implementation to do manipulate exif and jpeg data. Hopes this helps

like image 70
Nadim Farhat Avatar answered Oct 20 '22 05:10

Nadim Farhat