It seems that all this really does is grab the first 8k of the file. This is where the EXIF header data lives, and the thumbnail is part of that header. This header needs to be parsed, and the thumbnail extracted and decoded.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Compiled on FreeBSD 3.4, same broken thumbnails.
Toshiba PDR-M4
It seems that all this really does is grab the first 8k of the file. This is where the EXIF header data lives, and the thumbnail is part of that header. This header needs to be parsed, and the thumbnail extracted and decoded.