Optimized thumbnail creation