Changeset 59bbaa7 in subsurface


Ignore:
Timestamp:
May 6, 2017, 8:07:16 AM (3 months ago)
Author:
Dirk Hohndel <dirk@…>
Branches:
master
Children:
4627973
Parents:
0617308
git-author:
Stefan Fuchs <sfuchs@…> (05/05/17 09:50:51)
git-committer:
Dirk Hohndel <dirk@…> (05/06/17 08:07:16)
Message:

Image import: Make Exif handling more tolerant, better info,...

Changes to the "Add pictures to dive" function:

  • Make Exif handling more tolerant by removing the JPG sanity check for EOI
  • Give info to user if exif.cpp can't identify a Exif date/time
  • Restrict file dialog filter for correct picture time by DC photo to JPG because Exif is only available from JPG

Signed-off-by: Stefan Fuchs <sfuchs@…>

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • core/exif.cpp

    rb368ecd r59bbaa7  
    421421  if (buf[0] != 0xFF || buf[1] != 0xD8) return PARSE_EXIF_ERROR_NO_JPEG;
    422422
    423   // Sanity check: some cameras pad the JPEG image with null bytes at the end.
    424   // Normally, we should able to find the JPEG end marker 0xFFD9 at the end
    425   // of the image, but not always. As long as there are null/0xFF bytes at the
    426   // end of the image buffer, keep decrementing len until an 0xFFD9 is found,
    427   // or some other bytes are. If the first non-zero/0xFF bytes from the end are
    428   // not 0xFFD9, then we can be reasonably sure that the buffer is not a JPEG.
    429   while (len > 2) {
    430     if (buf[len - 1] == 0 || buf[len - 1] == 0xFF) {
    431       len--;
    432     } else {
    433       if (buf[len - 1] != 0xD9 || buf[len - 2] != 0xFF) {
    434         return PARSE_EXIF_ERROR_NO_JPEG;
    435       } else {
    436         break;
    437       }
    438     }
    439   }
    440423  clear();
    441424
  • desktop-widgets/simplewidgets.cpp

    rd5af6cab r59bbaa7  
    310310                                                              tr("Open image file"),
    311311                                                              DiveListView::lastUsedImageDir(),
    312                                                               tr("Image files (*.jpg *.jpeg *.pnm *.tif *.tiff)"));
     312                                                              tr("Image files (*.jpg *.jpeg)"));
    313313        if (fileNames.isEmpty())
    314314                return;
     
    402402                timestamp = picture_get_timestamp(fileName.toUtf8().data());
    403403                time_first.setTime_t(timestamp + m_amount);
    404                 ui.invalidFilesText->append(fileName + " " + time_first.toString());
     404                if (timestamp == 0)
     405                        ui.invalidFilesText->append(fileName + " - " + tr("No Exif date/time found"));
     406                else
     407                        ui.invalidFilesText->append(fileName + " - " + time_first.toString());
    405408                allValid = false;
    406409        }
Note: See TracChangeset for help on using the changeset viewer.