While cycling through Okinawa south of Naha, I came across a red traffic light. Looking to the left, there was a huge house built on an artificial tree. It did not strike me as that spectacular, but I figured since I had to wait I might as well take a snapshot.
This gigantic tree house restaurant can be found south of Naha on Okinawa, Japan. It is a restaurant called アジア (Asia). Shot with NIKON D80
I would have never expected this would turn out to be one of the most popular shots I ever took. It has been printed on 2 magazines.
Categories: Photography, Software Development Tags: Asia, Baumhaus, Japan, Naha, Okinawa, Photo, Picture, Ryukyu Islands, Tree House, アジア, 南西諸島, 日本, 日本国, 沖縄県, 那覇市
Most image editors do not offer settings for the preview image and thumbnail which are embedded into a JPEG file along with the actual image data.
Unfortunately, the size and quality of the embedded thumbnail is often not adequate for viewing. Using ExifTool and the ImageMagick tool ‘convert’ we can replace any thumbnail with a different JPEG image of an arbitrary size/resolution.
convert.exe a.jpg -thumbnail 160x160 -strip -quality 90 jpg:- | exiftool.exe "-ThumbnailImage<=-" -m -overwrite_original a.jpg |
In case you are using the above within a .BAT or .CMD file, remember to replace each percent sign by a double percent sign. the -thumbnail parameter will create a minimalistic JPEG file without additional meta data. The -strip command even removes any embedded color profile to save more space.
Optionally you could add a check if the internal thumbnail image is of a certain size or dimension before starting to replace it.
You might want to do a similar exchange of the PreviewImage (if present)
convert.exe a.jpg -thumbnail 570x570 -strip -quality 50 jpg:- | exiftool.exe "-PreviewImage<=-" -m -overwrite_original a.jpg |
In this case I am using a 570×570 target square, which is the same dimensions as created by a Nikon D80 SLR. Aspect ration will be preserved.
Following is a complete script for conditional replacement of the thumbnail image.
@ECHO OFF
SETLOCAL EnableDelayedExpansion
SET EXTENSION=.JPG
SET JPGDIR=.
SET THUMBNAIL_MINSIZE=3800
SET THUMBNAIL_SIZE=160x160
SET THUMBNAIL_QUALITY=85
SET ERRORFILE=%TEMP%\exiftool.rebuild.error.txt
SET TEMPFILE=%TEMP%\exiftool_tmp.jpg
ECHO Processing %JPGDIR%
IF EXIST "%ERRORFILE%" DEL %ERRORFILE%
IF %THUMBNAIL_MINSIZE%==0 (
FOR %%A IN ("%JPGDIR%\*%EXTENSION%") DO (
ECHO Replacing thumbnail in %%~nA%%~xA
convert.exe "%%A" -thumbnail %THUMBNAIL_SIZE% -quality %THUMBNAIL_QUALITY% jpg:- | exiftool.exe "-ThumbnailImage<=-" -m -overwrite_original "%%A" 2>>"%ERRORFILE%"
)
) ELSE (
FOR %%A IN ("%JPGDIR%\*%EXTENSION%") DO (
exiftool.exe -b -ThumbnailImage "%%A" > "%TEMPFILE%"
FOR %%R IN ("%TEMPFILE%") DO IF %%~zR LSS %THUMBNAIL_MINSIZE% (
IF %%~zR GTR 0 (
ECHO Size of thumbnail is %%~zR, which is less than %THUMBNAIL_MINSIZE%, replacing %%~nxA...
convert.exe "%%A" -thumbnail %THUMBNAIL_SIZE% -quality %THUMBNAIL_QUALITY% jpg:- | exiftool.exe "-ThumbnailImage<=-" -m -overwrite_original "%%A" 2>>"%ERRORFILE%"
exiftool.exe -b -ThumbnailImage "%%A" > "%TEMPFILE%"
FOR %%S IN ("%TEMPFILE%") DO ECHO New size is %%~zS
) ELSE (
ECHO File %%~nA%%~xA does not contain thumbnail, so we don't add one
)
) ELSE (
ECHO Size of thumbnail is %%~zR, no need to replace %%~nA%%~xA.
)
IF EXIST "%TEMPFILE%" DEL "%TEMPFILE%"
)
) |
More information on ImageMagick: http://www.imagemagick.org/script/command-line-processing.php
In case you wonder about the header image on this page: It was taken during a flight over the Karakorum Range in northern Pakistan, with perfect visibility of K2.

N 36°49' 38.67" E 75°13' 52.97" 11707m
Nikon D80 200mm f/13 1/500s ISO 100