Much faster sampling-based resize for thumbnails