来自Google Takeout的jpg批量加入json和jpg [英] bulk join json with jpg from Google Takeout

查看:137
本文介绍了来自Google Takeout的jpg批量加入json和jpg的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望留下Google照片,并且已经使用Google Takeout下载了所有照片.现在,我有一大堆包含json文件(我认为包含exif数据)和图像的文件夹.结构如下所示:home/user/Billeder/Takeout/Google Photos/2011-06-09/file.json. 主页/用户/Billeder/Takeout(2)/Google相册/2011-07-09/file.json.

我想将json数据与正确的图像结合起来,并在与它们的创建日期相对应的文件夹中组织图像. 我一直在看Exiftool,但是到目前为止找到的所有答案仅显示了如何对单个图像执行此操作.我正在寻找一种将所有数据与正确的图像批量合并的方法.

我正在尝试在linux命令行中执行此操作. 有办法吗?

从版本10.47开始,解决方案

Exiftool现在可以执行此操作.

在测试中,我看到了json文件名的两种不同格式,其中一些是filename.ext.json,有些是filename.json(json文件名中没有扩展名).这里有两个命令可以解决这两种情况.如果您像我一样混合使用,请同时运行.

在json文件名中具有扩展名的文件
exiftool -tagsfromfile '%d/%F.json' '-ImageTag<JsonTag' FileOrDir

json文件名中没有扩展名的文件
exiftool -tagsfromfile '%d/%f.json' '-ImageTag<JsonTag' FileOrDir

FileOrDir替换为您要处理的文件或目录.将ImageTag替换为要复制到的图像中标签的名称.将JsonTag替换为您要复制的json文件中标签的名称.如果您使用的是Windows而不是Linux,请使用双引号而不是单引号.

这是我在json文件中遇到的一些更有用的标签,以及在哪里复制它们的建议.标签名称中的两个(描述和标题)与相关的XMP标签相同,因此无需将其重定向到图像标签名称,只需在上述命令中将其保留为-Description-Title .
说明:文件说明.适当的放置位置是IPTC:Caption-Abstract,XMP:Description和EXIF:ImageDescription.您可以使用'-Caption-Abstract<Description'-Description'-ImageDescription<Description'复制这些文件.
标题:上传文件的名称.可以将其复制到TitleObjectDescriptionPreservedFileName.
:不确定,但是我猜测如果文件中有人在Picasa之类的程序中标记了人,则这将是名称列表,很可能来自RegionPersonDisplayName.
URL :这是可以从中下载图像的URL.警告:这是一个公共共享的URL,即使该图像被标记为私有,仍可以使用该URL下载.
GeoInfoAltitude _ GeoInfoLatitude _ GeoInfoLongitude _ :如果上传的文件已进行地理标记,则它们将是图像的高度",纬度"和经度".最好将它们复制到GPSAltitudeGPSLatitudeGPSLatitudeRefGPSLongitudeGPSLongitudeRef.由于GPS标签的性质(未签名),必须在西半球和/或南半球的图像也必须设置Ref标签.

示例命令:
复制gps标签
exiftool -tagsfromfile '%d/%F.json' '-GPSAltitude<GeoInfoAltitude_' '-GPSLatitude<GeoInfoLatitude_' '-GPSLatitudeRef<GeoInfoLatitude_' '-GPSLongitude<GeoInfoLongitude_' '-GPSLongitudeRef<GeoInfoLongitude_' FileOrDir

复制关键字
exiftool -tagsfromfile '%d/%F.json' '-Keywords<Tags' '-Subject<Tags' FileOrDir

复制说明
exiftool -tagsfromfile '%d/%F.json' '-Caption-Abstract<Description' '-ImageDescription<Description' -Description FileOrDir


编辑(2018年1月):与往常一样,谷歌将改变一切.上面的 GeoInfo * 标签已根据以下评论弃用,并已由 GeoDataAltitude GeoDataLatitude GeoDataLongitude 取代>.

Exiftool可以读取Json文件,因此,如果有其他更改,运行命令exiftool -s FILE.Json将列出所有可以复制的标签和可用数据.

I wish to leave Google photos, and I have downloaded all my photos using Google Takeout. Now I have a boatload of folders containing both json files (that I think contains exif data) and images. The structure looks like this: home/user/Billeder/Takeout/Google Photos/2011-06-09/file.json. home/user/Billeder/Takeout(2)/Google Photos/2011-07-09/file.json.

I want to join the json data with the correct images and organize the images in folders that correspond to their creation date. I have been looking at Exiftool, but all answers found so far only shows how to do this for a single image. What I'm looking for is a way to join all the data with the correct images in bulk.

I'm trying to do this in linux command line. Is there a way to do this?

解决方案

Exiftool now has the ability to do this as of ver 10.47.

In my testing, I've seen two different formats for the json filename, some where it is filename.ext.json and some where it is filename.json (no extension in the json filename). Here are two command to cover either situation. If you have a mixtures, as I do, run both.

Files with extension in the json filename
exiftool -tagsfromfile '%d/%F.json' '-ImageTag<JsonTag' FileOrDir

Files without extension in the json filename
exiftool -tagsfromfile '%d/%f.json' '-ImageTag<JsonTag' FileOrDir

Replace FileOrDir with the file or directory you wish to process. Replace ImageTag with the name of the tag in the image you want to copy to. Replace JsonTag with the name of the tag from the json file you wish to copy from. If you are on Windows instead of linux, use double quotes instead of single quotes.

Here are some of the more useful tags that I've encountered in the json file and my suggestions where to copy them. Two of the tag names, Description and Title, are the same as the related XMP tags, so they don't need to be redirected into the image tag name and can be left simply as -Description or -Title in the above commands.
description: Description of the file. The appropriate placement for this would be IPTC:Caption-Abstract, XMP:Description, and EXIF:ImageDescription. You could copy these with '-Caption-Abstract<Description', -Description, or '-ImageDescription<Description'.
title: Name of the uploaded file. This can be copied into Title, ObjectDescription or PreservedFileName.
people: Not sure but I'm guessing that if the file has had people tagged in a program such as Picasa, this would be the list of names, most likely from the RegionPersonDisplayName.
url: This is an URL that the image can be downloaded from. WARNING: It is a publicly shared URL and even if the image is marked private, it can still be downloaded with this URL.
GeoInfoAltitude_, GeoInfoLatitude_, and GeoInfoLongitude_: If the uploaded file was geotagged, these will be the Altitude, Latitude, and Longitude for the image. These would best be copied into GPSAltitude, GPSLatitude, GPSLatitudeRef, GPSLongitude, and GPSLongitudeRef. Because of the nature of GPS tags (unsigned), image that are in the Western and/or Southern hemisphere must also have the Ref tags set.

Example commands:
Copy gps tags
exiftool -tagsfromfile '%d/%F.json' '-GPSAltitude<GeoInfoAltitude_' '-GPSLatitude<GeoInfoLatitude_' '-GPSLatitudeRef<GeoInfoLatitude_' '-GPSLongitude<GeoInfoLongitude_' '-GPSLongitudeRef<GeoInfoLongitude_' FileOrDir

Copy Keywords
exiftool -tagsfromfile '%d/%F.json' '-Keywords<Tags' '-Subject<Tags' FileOrDir

Copy Description
exiftool -tagsfromfile '%d/%F.json' '-Caption-Abstract<Description' '-ImageDescription<Description' -Description FileOrDir


Edit (Jan 2018): As always, Google will change everything. The above GeoInfo* tags are deprecated according to the comment below and have been replaced by GeoDataAltitude, GeoDataLatitude, and GeoDataLongitude.

Exiftool can read Json files, so if there are other changes, running the command exiftool -s FILE.Json will list all the tags and available data that can be copied.

这篇关于来自Google Takeout的jpg批量加入json和jpg的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆