Improved generation of thumbnails