Extract thumbnail from jpeg file

Lay András picture Lay András · Apr 27, 2012 · Viewed 42.9k times · Source

I'd like to extract thumbnail image from jpegs, without any external library. I mean this is not too difficult, because I need to know where the thumbnail starts, and ends in the file, and simply cut it. I study many documentation ( ie.: http://www.media.mit.edu/pia/Research/deepview/exif.html ), and try to analyze jpegs, but not everything clear. I tried to track step by step the bytes, but in the deep I confused. Is there any good documentation, or readable source code to extract the info about thumbnail start and end position within a jpeg file?

Thank you!

Answer

Riot picture Riot · Aug 24, 2016

Exiftool is very capable of doing this quickly and easily:

exiftool -b -ThumbnailImage my_image.jpg > my_thumbnail.jpg