Greatly improve performance by processing per file and use image/jpeg compression for thumbnails