Python extract binary data (Thumbnail)

Started by ton, May 02, 2025, 11:45:40 AM

Previous topic - Next topic

ton

Help me. I can extract Thumbnail from PDF using the command line exiftool.exe -b -ThumbnailImage "d:\test\color.pdf" > d:\test\color_thumbnail.jpg
But I can't extract binary data using python.
This Thumbnail is stored in the "XMP: Thumbnailimage" tag.
I have tried different commands/tags for get the Thumbnailimage binary data in the "results" variable.


from exiftool import ExifToolHelper
image_path = r"d:\test\color.pdf"
tags = ["-b", "-XMP__Thumbnailimage"]
# tags = ["-b", "XMP: Thumbnailimage"]
with ExifToolHelper() as et:
    results = et.execute(*tags, image_path)
    # result = et.execute("-b", ["XMP:ThumbnailImage"], image_path)

Please show an example of the correct syntax for extracting binary data from the desired tag (for example, Thumbnail) using PyExifTool.

StarGeek

I'm sorry but PyExifTool is a third party wrapper and there isn't anyone here that can provide support for it.

But looking at the examples on Examples / Quick Start, I think what you want would be

tags = ["-b", "-XMP:Thumbnailimage"]
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype