简体   繁体   中英

How to get Text Stamps of a TIFF Image using Python

When using TIFF-Editor, you can add Stamps to tiff images (Basically just Text). You can also edit and remove stamps someone else added before.

Is there a way to read the stamps an image contains via python? The objective is to automate a process where a person reads those stamps and decides where to direct the file to.

I already tried opening the files and get some META data about them via exifRead. It doesn't tell anything about the stamps though.

import exifread
f = open("src.tif", 'rb')
tags = exifread.process_file(f)
print(tags)

Works with python 3.6, using Pillow.

from PIL import Image
from PIL.TiffTags import TAGS

with Image.open('image.tiff') as img:
    meta_dict = {TAGS[key] : img.tag[key] for key in img.tag}

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM