どんちゃんのひまつぶし

とあるスタートアップにいるエンジニアの雑多ブログ

Google Photoの写真を全部ダウンロードしたら日付がDL日になるのでOSSで解決した

Google Photoのストレージサイズが大きくなったので、一部写真をまとめて別のストレージに移したくなりました。

Googleデータエクスポートで写真をダウンロードすると、下記のように写真のExif情報の作成日と変更日がエクスポートを実行した日付となってしまいます。

これでは整理に非常に困ります。そこで、OSSのアプリケーションで解決できたので紹介していきます。

下準備

GoogleデータエクスポートからGooglePhotoのデータをダウンロード

support.google.com

解凍し、こんな感じのディレクトリに整理します(複数zipに分割されていた場合)

└── ダウンロード/
    └── Takeout/
        └── Googleフォト/
            ├── Photos from 20xx
            ├── Photos from 20xx
            ├── Photos from 20xx
            ├── Photos from 20xx
            ├── Photos from 20xx
            └── (アルバム名)

使うツール・手順

CUIなので、慣れてない人やエンジニアではない人には難しいかもしれないですが、コピペでできるように説明します。

私はmacユーザーなのでmacOS前提で進めていきます。

ダウンロード

GooglePhotosTakeoutHelperを使用します。

リリースページからgpth-macosをダウンロードします。

とりあえずダウンロードフォルダに置いておいてください。

手順

softwareupdate --install-rosetta # もしApple Siliconマシンで、rosettaがなければインストール
cd downloads # ダウンロードフォルダに移動
chmod +x gpth-macos # 実行許可を付与(一応自己責任で)
xattr -r -d com.apple.quarantine gpth-macos # macOSに安全なアプリであることを教える(一応自己責任で)
./gpth-macos # 実行

こんな感じで起動するので、ここに表示される手順に従っていきます。

Enterを押し、先ほど作成したTakeoutフォルダーを選択します。 2回目のEnter押下で出力先となるOutputフォルダーを選択します(任意のフォルダ)

オプション

  • 出力方法

一つのフォルダにまとめるか、年月ごとにまとめるか

Do you want your photos in one big chronological folder, or divided to folders by year/month?

[1] (default) - one big folder

[2] - year/month folders

(Type 1 or 2 or press enter for default):

  • アルバムの扱い

ショートカットにするのか、何もしないのかなど

What should be done with albums? [0] shortcut: [Recommended] Album folders with shortcuts/symlinks to original photos. Recommended as it will take the least space, but may not be portable when moving across systems/computes/phones etc

[1] duplicate-copy: Album folders with photos copied into them. This will work across all systems, but may take wayyy more space!!

[2] json: Put ALL photos (including Archive and Trash) in one folder and make a .json file with info about albums. Use if you're a programmer, or just want to get everything, ignoring lack of year-folders etc.

[3] nothing: Just ignore them and put year-photos into one folder. WARNING: This ignores Archive/Trash !!!

処理が完了したらこんな感じでOutputフォルダに出力されます。