Exiv2 / exiv2

Image metadata library and tools
http://www.exiv2.org/
Other
911 stars 280 forks source link

Add missing preview images in manpage example image #1948

Open postscript-dev opened 2 years ago

postscript-dev commented 2 years ago

Is your feature request related to a problem? Please describe. In addition to a file's main image, the metadata can contain several other smaller versions of that image (see PREVIEW IMAGES AND THUMBNAILS in the manpage). Exiv2 does not extract all of the available previews in an image.

For example, in PREVIEW IMAGES AND THUMBNAILS, the Stonehenge.jpg file is listed as only containing 1 preview which is the thumbnail:

$ curl --silent -O https://clanmills.com/Stonehenge.jpg
$ exiv2 --print p Stonehenge.jpg
Preview 1: image/jpeg, 160x120 pixels, 10837 bytes

When using ExifTool though, there are 3 previews available:

C:\temp>exiftool -v -a -b -W %d%f_%t%-c.%s -preview:all Stonehenge.jpg
Wrote ThumbnailImage to Stonehenge_ThumbnailImage.jpg
Wrote PreviewImage to Stonehenge_PreviewImage.jpg
Wrote MPImage3 to Stonehenge_MPImage3.jpg
    3 output files created

The 3 images can be found in Stonehenge_previews_using_ExifTool.zip.

Describe the solution you'd like Stonehenge.jpg is used in the manpage as a sample file. Adding the missing previews, would demonstrate how the feature works, helping others to understand the mechanism.

Additional context There is a discussion in #1893 about adding preview images to files.

clanmills commented 2 years ago

This matter is discussed in my book: https://clanmills.com/exiv2/book/#5. The code to deal with this for JPEG and CR3 files is in tvisitor.cpp

Additionally, I have been working with David to extract format specific thumbnails from CR3 files: https://github.com/Exiv2/exiv2/issues/1893#issuecomment-934381773

@postscript-dev It could be most helpful if you could "scope" this issue as I am sure there are other formats (PNG, TIFF and others) which have multiple thumbnails which are not reported by Exiv2. The way to "scope" this issue is to use the ExifTool's test image repository and compare the thumbnail extraction of ExifTool and Exiv2.

I believe the code to modify/replace/delete thumbnails is weak. In the first instance, finding and extracting thumbnails is a precursor to a future project about editing thumbnails.

postscript-dev commented 2 years ago

At the moment, I don't have time to widen the scope. I will try and look at this again at some point.

clanmills commented 2 years ago

Thanks for logging this issue, Peter. The Exiv2 preview code was added more than 10 years ago and you're the first person to open an issue about this. The number of folks contributing to Exiv2 is steadily increasing. One day this will get attention.