I am a complete beginner in Python, and would like to start learning it by doing. Namely, I’d love to correct some EXIF information in a huge bunch of family photos I have. To start with, I want to just get this information out of JPEG files properly.
Some of them have a title written in EXIF. It can be obtained e.g. by
import pyexiv2
metadata = pyexiv2.ImageMetadata(filename)
metadata.read()
title = metadata['Exif.Image.XPTitle']
This far I’ve got. Now comes the problem. Some of the titles contain Cyrillic letters. If I do print title.human_value I get for example
`Милой Мамуле от Майи, 11 ÑÐ½Ð²Ð°Ñ€Ñ 1944.`
while with print title, it is
<Exif.Image.XPTitle [Byte] = 28 4 56 4 59 4 62 4 57 4 32 0 28 4 48 4 60 4 67 4 59 4 53 4 32 0 62 4 66 4 32 0 28 4 48 4 57 4 56 4 44 0 32 0 49 0 49 0 32 0 79 4 61 4 50 4 48 4 64 4 79 4 32 0 49 0 57 0 52 0 52 0 46 0 0 0>
The actual string I’d love to see is
Милой Мамуле от Майи, 11 января 1944.
It seems to be a unicode problem, but after trying already a dozen of different methods found here and elsewhere, I just cannot cope with it. Is it possible to see Russian letters in the console at all? I am using python(xy) on Windows 7 (English), so my IDE is spyder2. Just the default installation, to which I added pyexiv2. TIA!
The bytes are UTF-16.
In Python 3:
In Python 2: