Picasa 随机重新编辑了我的所有照片

Picasa 随机重新编辑了我的所有照片

我使用 Picasa 来管理照片。我最近从 Windows 计算机换成了 Mac,因此我使用外部硬盘将照片从旧计算机传输到新计算机。起初一切都很好,但现在 Picasa 的文件日期似乎与照片元数据中的日期不同(在某些情况下相隔 20 年)。它似乎随机重新标注了我所有照片的日期。因此,它们不再按日期顺序排序。

我已删除该文件夹并将其替换为监视文件夹,并刷新了所有缩略图,但这并没有给我带来所需的效果。我该怎么做才能恢复照片上的正确日期?

答案1

因此,这里有一个示例脚本,它将根据嵌入的 EXIF 数据将图像文件批量重命名为以拍摄图像的日期和时间开头的标准。它还会执行其他一些操作。您需要根据自己的需要对其进行调整。我将相机名称包含在图像名称中,以防日期/时间发生冲突,因为这可以帮助我知道是谁拍摄了照片。如果名称发生冲突,它还会在名称末尾添加一个序列号。

您将需要两个命令行工具:jhead尽管exiftool您可能可以修改它以仅使用一个。它是一个 BASH 脚本,因此应该可以在任何可以运行 BASH 和两个助手的地方工作 - 我经常使用 Cygwin 在 Windows 笔记本电脑上运行它。

#!/bin/bash

# Rename camera files to a standard

# jhead (jhead -n%Y-%m-%d %H-%M-%S-Camera Name.jpg)
# exiftool, exiv2, exif


case $1 in
    --help|-h|-?)
        echo ' '
        echo 'Rename a folder full of files to match the date/time taken and the camera model:'
        echo '  "IMG_0001.jpg"   ==>   "2007-05-30 13-24-05-Canon PowerShot A720 IS.jpg"'
        echo '  Adds a letter to end of name if the result is not unique'
        echo ' '
        echo 'Please use as:'
        echo '  rename.sh folderName [t]'
        echo 'Where:'
        echo '  folderName is absolute or relative to current folder'
        echo '  t, if present prints the command that would be used'
        echo ' '
        echo 'Requirements:'
        echo '  1) jhead (detects camera type)'
        echo '  2) exiftool (renames non-jpg files)'
        echo ' '
        echo 'Use the following workflow:'
        echo '  1) Copy files and folders from the camera(s) to a temp folder'
        echo '  2) Run this against the temp folder and check the renames'
        echo '  3) Manually rename any left-overs'
        echo '  4) Add IPTC comments, locations, etc.'
        exit
esac

if [ -z "$1" ]; then
    #echo 'You need to specify the folder to work on (end with a trailing /)'
    ## use pwd instead
    FOLDER="`pwd`"
else
    FOLDER=$1
fi

if [ -x /usr/bin/jhead ]; then
    # Check if starts with leading / if not, then prepend pwd for safety
    #   NB: Note the substring processing: ${varname:start:numChars}
    if [ ${FOLDER:0:1} != '/' ]; then
        FOLDER="`pwd`/$FOLDER"
    fi

    # Add trailing / if required
    if [ ${FOLDER:${#FOLDER}-1:1} != '/' ]; then
        FOLDER="$FOLDER/"
    fi

    echo "$FOLDER"
    cd "$FOLDER"

    # Make sure all files are writable
    chmod +w *

    # Turn upper case extensions into lower case <== CANCEL THIS, the case helps id the camera
    #echo "rename 's/\.JPG$/.jpg/' *.JPG"
    #/usr/bin/rename 's/\.JPG$/.jpg/' *.JPG
    # The above seems to have stopped working for some reason, try this instead
    #echo "/usr/bin/rename '.JPG' '.jpg' *.JPG"
    #/usr/bin/rename '.JPG' '.jpg' *.JPG

    ## REPLACE jhead WITH exiftool
    ARTIST1=" '-IPTC:By-line=Julian Knight, http://www.knightnet.org.uk/contact.htm?toname=JulianPhotos' "
    ARTIST2=" '-IPTC:By-line=James Knight, http://www.knightnet.org.uk/contact.htm?toname=JamesPhotos' "
    COPYRIGHT=" '-IPTC:CopyrightNotice<Copyright © ${CreateDate} Julian Knight, all rights reserved' -d '%Y' "
    ##  IPTC meta (Creator, Rights in XMP)
    ## Move to folders: ./mm-mmm

    echo "jhead -model A70 -exonly -nf'%Y-%m-%d %H-%M-%S-Canon PowerShot A70' -ft *.jpg"
    jhead -model A70 -exonly -nf'%Y-%m-%d %H-%M-%S-Canon PowerShot A70' -ft *.jpg

    echo "jhead -model A720 -exonly -nf'%Y-%m-%d %H-%M-%S-Canon PowerShot A720 IS' -ft *.jpg"
    jhead -model A720 -exonly -nf'%Y-%m-%d %H-%M-%S-Canon PowerShot A720 IS' -ft *.jpg

    echo "jhead -model A720 -exonly -nf'%Y-%m-%d %H-%M-%S-Canon PowerShot A720 IS' -ft *.JPG"
    jhead -model A720 -exonly -nf'%Y-%m-%d %H-%M-%S-Canon PowerShot A720 IS' -ft *.JPG

    echo "jhead -model Hero -exonly -nf'%Y-%m-%d %H-%M-%S-MDA Compact III' -ft *.jpg"
    jhead -model Hero -exonly -nf'%Y-%m-%d %H-%M-%S-MDA Compact III' -ft *.jpg

    echo "jhead -model T8282 -exonly -nf'%Y-%m-%d %H-%M-%S-HTC Touch HD' -ft *.jpg"
    jhead -model T8282 -exonly -nf'%Y-%m-%d %H-%M-%S-HTC Touch HD' -ft *.jpg

    echo "jhead -model DCR-PC120E -exonly -nf'%Y-%m-%d %H-%M-%S-Sony DCR-PC120E' -ft *.jpg"
    jhead -model DCR-PC120E -exonly -nf'%Y-%m-%d %H-%M-%S-Sony DCR-PC120E' -ft *.jpg

    echo "jhead -model D90 -exonly -nf'%Y-%m-%d %H-%M-%S-NIKON D90' -ft *.JPG"
    jhead -model D90 -exonly -nf'%Y-%m-%d %H-%M-%S-NIKON D90' -ft *.JPG

    # James' Samsung S860 Make: Samsung Techwin, Model: <KENOX S860  / Samsung S860>
    echo "jhead -model S860 -exonly -nf'%Y-%m-%d %H-%M-%S-Samsung S860' -ft sdc?????.jpg"
    jhead -model S860 -exonly -nf'%Y-%m-%d %H-%M-%S-Samsung S860' -ft sdc?????.jpg
    #exiftool '-if $make eq "Samsung Techwin"' '-if $model eq "<KENOX S860  / Samsung S860>"' -overwrite_original_in_place sdc?????.jpg

    # Deal with .NEF (Nikon Raw) files (rename to YYYY-MM-DD HH-MM-SS-NIKON D90-DSC_????.NEF)
    exiftool '-FileName<${CreateDate}-NIKON D90-%f.%e' -d '%Y-%m-%d %H-%M-%S' DSC_????.NEF
    # Use %c to add seq num where required

    # Deal with .AVI files (rename to YYYY-MM-DD HH-MM-SS-NIKON D90-DSC_????.AVI)
    exiftool '-FileName<${FileModifyDate}-NIKON D90-%f.%e' -d '%Y-%m-%d %H-%M-%S' DSC_????.AVI

    # Deal with .AVI files (rename to YYYY-MM-DD HH-MM-SS-Samsung S860-sdc?????.avi)
    exiftool '-FileName<${FileModifyDate}-Samsung S860-%f.%e' -d '%Y-%m-%d %H-%M-%S' sdc?????.avi

    echo ' '
    echo 'FINISHED RENAME'
    echo ' '
else
    echo 'You need to install jhead first'
fi

请注意,如果您想包含相机名称,则需要找出您的相机在 EXIF 数据中使用的制造商名称,并相应地更改命令。

对每个图像文件夹运行此操作,最终应该会以这样一种方式命名它们,即无论操作系统或其他工具对文件创建和修改日期做了什么,它们都会按名称排序,按照拍摄的顺序排列。请注意,无论如何你都不能真正信任它们,因为它们可能会发生变化的原因有很多(例如,创建日期可能会在执行某些复制/移动命令后被重置)。

相关内容