Function: image-dired-get-exif-file-name

image-dired-get-exif-file-name is a byte-compiled function defined in image-dired.el.gz.

Signature

(image-dired-get-exif-file-name FILE)

Documentation

Use the image's EXIF information to return a unique file name.

The file name should be unique as long as you do not take more than one picture per second. The original file name is suffixed at the end for traceability. The format of the returned file name is YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg. Used from image-dired-copy-with-exif-file-name.

Source Code

;; Defined in /usr/src/emacs/lisp/image-dired.el.gz
(defun image-dired-get-exif-file-name (file)
  "Use the image's EXIF information to return a unique file name.
The file name should be unique as long as you do not take more than
one picture per second.  The original file name is suffixed at the end
for traceability.  The format of the returned file name is
YYYY_MM_DD_HH_MM_DD_ORIG_FILE_NAME.jpg.  Used from
`image-dired-copy-with-exif-file-name'."
  (let (data no-exif-data-found)
    (if (not (eq 'jpeg (image-type (expand-file-name file))))
        (setq no-exif-data-found t
              data (format-time-string
                    "%Y:%m:%d %H:%M:%S"
                    (file-attribute-modification-time
                     (file-attributes (expand-file-name file)))))
      (setq data (image-dired-get-exif-data (expand-file-name file)
                                            "DateTimeOriginal")))
    (while (string-match "[ :]" data)
      (setq data (replace-match "_" nil nil data)))
    (format "%s%s%s" data
            (if no-exif-data-found
                "_noexif_"
              "_")
            (file-name-nondirectory file))))