Exiv2 wrapper for Python >= 3.4 on Windows
Project description
Low-level wrapper for exiv2 for python >= 3.3 that pip-installs on Windows.
only works on Windows.
only supports Iptc for now. Exif and Xmp are on their way.
straight-up exposure of the C++ methods. Feel free to write more pythonic classes on top.
How do I set it up?
pip install exiv2
Example
import exiv2 from PIL import Image def example(path): ''' Open an image on disk and get one piece of IPC data. ''' with open(path, "rb") as f: imdata = f.read() im = exiv2.ImageFactory.open(imdata) im.readMetadata() ipc_data = im.iptcData() # exiv2 method "toString()" actually returns bytes, so we have to decode it info = ipc_data[b'Iptc.Application2.Caption'].toString().decode('utf-8') return info def example2(): ''' Open image, change IPTC data and save the image. ''' image = exiv2.ImageFactory.open(r"c:\test\test.jpg") image.readMetadata() ipc_data = image.iptcData() for datum in ipc_data: print(datum.key(), datum.value().toString()) ipc_data[b'Iptc.Application2.Subject'] = b'subject' image.writeMetadata() def example3(): ''' Open image in memory ''' with open(r"c:\test\test.jpg", "rb") as f: imdata = f.read() im = exiv2.ImageFactory.open(imdata) im.readMetadata() new_iptc_data = exiv2.IptcData() new_iptc_data[b"Iptc.Application2.Caption"] = b'Hi Mom!' im.setIptcData(new_iptc_data) im.clearExifData() im.clearXmpData() im.writeMetadata() io = im.io() size = io.size() buffer = io.read(size) with open(r"c:\test\out.jpg", "wb") as f: f.write(buffer) if __name__ == '__main__': example1() example2()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distributions
exiv2-0.3.1-cp38-cp38-win_amd64.whl
(985.1 kB
view hashes)
exiv2-0.3.1-cp38-cp38-win32.whl
(852.9 kB
view hashes)
exiv2-0.3.1-cp37-cp37m-win_amd64.whl
(984.9 kB
view hashes)
exiv2-0.3.1-cp37-cp37m-win32.whl
(852.6 kB
view hashes)
exiv2-0.3.1-cp36-cp36m-win_amd64.whl
(986.4 kB
view hashes)
exiv2-0.3.1-cp36-cp36m-win32.whl
(854.1 kB
view hashes)
exiv2-0.3.1-cp35-cp35m-win_amd64.whl
(986.4 kB
view hashes)
exiv2-0.3.1-cp35-cp35m-win32.whl
(854.1 kB
view hashes)
exiv2-0.3.1-cp34-cp34m-win_amd64.whl
(986.4 kB
view hashes)
exiv2-0.3.1-cp34-cp34m-win32.whl
(854.1 kB
view hashes)
Close
Hashes for exiv2-0.3.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d23369b56c07f8bacfa1339a7de00ba48a6e6211a1429c6a8b344e7d8cf37a5b |
|
MD5 | 462b07224fb91895a101b3f587fdc337 |
|
BLAKE2b-256 | 4e32d1bfd52615f1f233c3b08b892342653efe28d7272d0aa6264a2859cd5602 |
Close
Hashes for exiv2-0.3.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb20d0afeadce25dde44d633e3fa69063bc52cb18e558682486d9a49d2899cea |
|
MD5 | bda05207051fc32b4c3390357293e393 |
|
BLAKE2b-256 | b7902866dce11c463a8d9f0fb1c48c07cdecd4cf2d8a693d02406c077d00b046 |
Close
Hashes for exiv2-0.3.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 25d2ec5307b0539dd18eb6694f916d6dabaeb4acaad0267530cf5b266c29a093 |
|
MD5 | 5c94ec5063e245871947b1cb0f2b0669 |
|
BLAKE2b-256 | b9ddd1a08c355de44813ec7d61128ee0250efbfbadbfc6bfc05fa42e4e0103f1 |
Close
Hashes for exiv2-0.3.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3b575584e382b8f2fec923040bdd7dd077914f9ee3bed0158fcd855bc72eaf62 |
|
MD5 | fd3ec1b9aa4f11693ab9d4935de0a7b6 |
|
BLAKE2b-256 | cd8a091af43b56b9639c33485cb63265b8f7d7339f0f8e20ebe22cc62607d8bb |
Close
Hashes for exiv2-0.3.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 469e97171412c95616148658187668c48e70e33b326683a08a07898be9aeb42c |
|
MD5 | 75edb60831e076a92e9f2aef7dbd66c6 |
|
BLAKE2b-256 | 1318114d3160bf3edb45686557842e1bdba39af3483b847ffcca98af40522b77 |
Close
Hashes for exiv2-0.3.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f0b693545c079111aaadd1415b1a0f25545901e3861f5559ab52a13c9866d87 |
|
MD5 | 116be75c64ba780cf1e1c5767c8de5db |
|
BLAKE2b-256 | 8a6f01f864e3f5f877711c7bd9467c5e4ab41b11a6c22f29709846e551d2c4bd |
Close
Hashes for exiv2-0.3.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 415172680108887ad119eb74ae92f97b829e9b3811b7e266585366da53d3e6e6 |
|
MD5 | 59ba588466cd6c63606e8d7b1043ba97 |
|
BLAKE2b-256 | e1736004552e5aa73117aedee1dab8817ed177279cb5fdf6ab1b0bb77c3e7977 |
Close
Hashes for exiv2-0.3.1-cp34-cp34m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ed9d052066939c9a0cc1feb59f5d718f6cfc004df88007cd7218332cc41b5ff2 |
|
MD5 | f55f712f97af620581591884916627a0 |
|
BLAKE2b-256 | 64acb19699ab82105e9cce1a1a5745ce0103229778e2739f4f4d40b73aa0cb62 |
Close
Hashes for exiv2-0.3.1-cp34-cp34m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f47d55ae9aca83e20982ae3c9ba20afc0708671c98b9222aef3cfb0917109975 |
|
MD5 | 0af3383b5208a172bbc2494c19574f13 |
|
BLAKE2b-256 | c16ecdf96bbeab10fe22f79ec18abb3ea9892a6211fbae79bc1f4c479fa4c86f |