how to modify the last modification date of jpg file with libexif. C

26 Views Asked by At

I can get the datetime from GPS data, then i try to modify the last modification date of jpg file with libexif. Embedded device with linux OS. Read jpg file at Windows.

    char date_time[20];
    // shooting date 
    sprintf(date_time, "%s", "2023:12:01 11:04:12");
    // EXIF_TAG_SUB_SEC_TIME EXIF_TAG_SUB_SEC_TIME_ORIGINAL EXIF_TAG_SUB_SEC_TIME_DIGITIZED 
    entry = create_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_ORIGINAL, sizeof(date_time), EXIF_FORMAT_ASCII);
    memcpy(entry->data, date_time, sizeof(date_time));

    // digital date
    entry = create_tag(exif, EXIF_IFD_EXIF, EXIF_TAG_DATE_TIME_DIGITIZED, sizeof(date_time), EXIF_FORMAT_ASCII);
    memcpy(entry->data, date_time, sizeof(date_time));

    //the last modifiction date
    entry = create_tag(exif, EXIF_IFD_0, EXIF_TAG_DATE_TIME, sizeof(date_time), EXIF_FORMAT_ASCII);
    memcpy(entry->data, date_time, sizeof(date_time));

Only the shooting date is Okay. I expect that the last modification date of file could be modified too.

0

There are 0 best solutions below