Extract all types of thumbnails from a single image

Started by gbartoli, May 05, 2016, 04:36:00 AM

Previous topic - Next topic

gbartoli

Hi,
First of all, I would like to congratulate to Phil for making such a powerful and flexible tool for image analysis, I'm using it on a daily basis for a number of projects on digital image forensics. 8)

From the exiftool documentation, I found this command that extracts the embedded data corresponding to ThumbnailImage tag and write to the output file
exiftool -b -ThumbnailImage image.jpg > folder/thumbnail.jpg

However, I have some images that contain thumbnails inside different tags, like PreviewImage, so I would like to run a single command that extracts all kinds of thumbnails from a single image and puts them into a specified folder, preferably appending the tag names like image_ThumbnailImage.jpg, image_PreviewImage.jpg, etc...

I found also this:
exiftool -a -b -W %d%f_%t%-c.%s -preview:all DIR
but it works on all images in the folder DIR, I couldn't find a way to make it work on a single image while writing thumbnails in a specified folder.

Am I missing something?

Thanks in advance.
-= Guido =-

Phil Harvey

Hi Guido,

You are very close with the command you found.  I think that a simple modification to specify the output folder name instead of using %d should give you what you want:

exiftool -a -b -W FOLDERNAME/%f_%t%-c.%s -preview:all FILE

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

gbartoli

Yes, that is exactly what I wanted, thanks Phil! :)
-= Guido =-

DvO

I wanted to extract the embeded thumbnails contained in a panorama image file shot using the GCam app on my smartphone as suggested here:
exiftool  -a -b -W pano_20220327_101020_vr.jpg_thumbnails/%f_%t%-c.%s -preview:all pano_20220327_101020.vr.jpg

but exiftool says:
Warning: Incomplete extended XMP (GUID 665523b74257018c2e4859f81df578a4) - pano_20220327_101020.vr.jpg
    0 output files created



According to the output of https://processing.compress-or-die.com/analyze-process the file contains many JPEG markers with name APP1 of this format:
EXIF Metadata, TIFF IFD format, JPEG Thumbnail (160×120), Adobe XMP

I attach the input file for reference.

StarGeek

There are a lot of problems with that file
C:\>exiftool -g1 -a -s -warning -validate Y:\!temp\ccc\pano_20220327_101020.vr.jpg
---- ExifTool ----
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Unknown APP1 segment
Warning                         : [minor] Odd offset for IFD0 tag 0x02bc ApplicationNotes
Warning                         : [minor] Non-standard XMP at JPEG-APP1-IFD0-XMP
Warning                         : Entries in IFD0 are out of order
Warning                         : Tag ID 0x0101 ImageHeight out of sequence in IFD0
Warning                         : [minor] Odd offset for IFD0 tag 0x010f Make
Warning                         : Entries in ExifIFD are out of order
Warning                         : Tag ID 0x9004 CreateDate out of sequence in ExifIFD
Warning                         : [minor] Odd offset for ExifIFD tag 0x9012 OffsetTimeDigitized
Warning                         : Tag ID 0x9011 OffsetTimeOriginal out of sequence in ExifIFD
Warning                         : Non-standard format (int32u) for ExifIFD 0x9208 LightSource
Warning                         : Tag ID 0x9208 LightSource out of sequence in ExifIFD
Warning                         : Tag ID 0x0112 Orientation out of sequence in IFD0
Warning                         : [minor] Unknown value for IFD0:Orientation
Warning                         : [minor] XMP is missing xpacket wrapper
Warning                         : Incomplete extended XMP (GUID 665523b74257018c2e4859f81df578a4)
Warning                         : Missing required JPEG ExifIFD tag 0x9000 ExifVersion
Warning                         : Missing required JPEG ExifIFD tag 0x9101 ComponentsConfiguration
Warning                         : Missing required JPEG ExifIFD tag 0xa000 FlashpixVersion
Warning                         : Missing required JPEG ExifIFD tag 0xa001 ColorSpace
Warning                         : Missing required JPEG ExifIFD tag 0xa002 ExifImageWidth
Warning                         : Missing required JPEG ExifIFD tag 0xa003 ExifImageHeight
Warning                         : [minor] IFD0 tag 0x0100 ImageWidth is not allowed in JPEG
Warning                         : [minor] IFD0 tag 0x0101 ImageHeight is not allowed in JPEG
Warning                         : [minor] Missing required JPEG IFD0 tag 0x011a XResolution
Warning                         : [minor] Missing required JPEG IFD0 tag 0x011b YResolution
Warning                         : [minor] Missing required JPEG IFD0 tag 0x0128 ResolutionUnit
Warning                         : [minor] Missing required JPEG IFD0 tag 0x0213 YCbCrPositioning
Validate                        : 50 Warnings (35 minor)


But other than that, if you look at the output with the command in FAQ #3, exiftool can't find the preview data.  Looking directly in the file data, it appears to be there, but the XMP is so broken that exiftool can't extract it.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

pts

Quote from: Phil Harvey on May 05, 2016, 07:33:38 AMHi Guido,

You are very close with the command you found.  I think that a simple modification to specify the output folder name instead of using %d should give you what you want:

exiftool -a -b -W FOLDERNAME/%f_%t%-c.%s -preview:all FILE

- Phil

Is there a way of directly copy exif data to the preview/thumb ?

Phil Harvey

That would require a second command to copy the metadata.  Automating this for a whole directory is tricky and I don't have time to work up a command for you right now, but it could be done using the -fileNUM feature.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux/PowerShell, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

florimond

Hello ! I desperately need you guys' help! I can't for the life of me extract the thumbnail from one of my photos, I just don't understand how the tool works...


Thanks in advance for your help !

StarGeek

You don't say what OS you are using, but the basic idea would be the same as this

1. Open a CMD if on Windows, Terminal if on Mac, or bash if on Linux. Exiftool is a command line program and needs to be run from a command line in most cases.

2. Type or copy/paste this into the command line.  Make sure there is a space after "all"
exiftool -a -b -W %d%f_%t%-c.%s -preview:all

3. You can then add the file paths to any files and/or directories to the end. In most command lines, you can drag/drop the files/directories onto the command line, and it will be filled out for you. If you have files in the subdirectories, add a -r and a space to the end of the command before you drag/drop

4. Hit enter. Exiftool will then run through all the files and extract any preview images into the same directory where the images are.

To get the most out of exiftool, you should go looking for tutorials on using the command line and learn some of the basics.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).