ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: gbartoli on May 05, 2016, 04:36:00 AM

Title: Extract all types of thumbnails from a single image
Post by: gbartoli on May 05, 2016, 04:36:00 AM
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.
Title: Re: Extract all types of thumbnails from a single image
Post by: Phil Harvey on May 05, 2016, 07:33:38 AM
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
Title: Re: Extract all types of thumbnails from a single image
Post by: gbartoli on May 05, 2016, 08:03:05 AM
Yes, that is exactly what I wanted, thanks Phil! :)
Title: Re: Extract all types of thumbnails from a single image
Post by: DvO on June 05, 2022, 01:33:57 PM
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.
Title: Re: Extract all types of thumbnails from a single image
Post by: StarGeek on June 06, 2022, 11:27:12 AM
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 (https://exiftool.org/faq.html#Q3), 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.
Title: Re: Extract all types of thumbnails from a single image
Post by: pts on May 24, 2023, 04:01:45 PM
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 ?
Title: Re: Extract all types of thumbnails from a single image
Post by: Phil Harvey on May 24, 2023, 04:09:50 PM
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