2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

アリバイ工作のために写真のExif情報の日付を変更する

Last updated at Posted at 2022-04-18

概要

撮影画像のExifの日時を変更する。例として現在時刻に変更する。
処理対象の画像⇒FullSizeRendser-1024x678.JPG

コード

import pyexiv2
import datetime
# 現在時刻取得
dt_now = datetime.datetime.now()

# ファイルオープン
img = pyexiv2.Image( "FullSizeRendser-1024x678.JPG" )

# メタデータ読み込み
metadata = img.read_exif()

# 更新時刻、デジタルデータ化時刻、撮影時刻 を 現在時刻 に書き換え
metadata["Exif.Image.DateTime"] = dt_now
metadata["Exif.Photo.DateTimeOriginal"] = dt_now
metadata['Exif.Photo.DateTimeDigitized'] = dt_now

# メタデータ を img に書き戻し
img.modify_exif( metadata )

# ファイルクローズ
img.close()
2
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?