EADST

Python: Merge Two Images

Python: Merge Two Images

from PIL import Image

def get_concat_h(im1, im2):
    dst = Image.new('RGB', (im1.width + im2.width, im1.height))
    dst.paste(im1, (0, 0))
    dst.paste(im2, (im1.width, 0))
    return dst

def get_concat_v(im1, im2):
    dst = Image.new('RGB', (im1.width, im1.height + im2.height))
    dst.paste(im1, (0, 0))
    dst.paste(im2, (0, im1.height))
    return dst

save_dir = "./merge"
for root, _, imgs in os.walk("./left_imgs/"):
        for img in imgs:
            im1 = Image.open('./left_imgs/{}'.format(img))
            im2 = Image.open('./right_imgs/{}'.format(img))
            new = get_concat_h(im1, im2)
            new.save(os.path.join(save_dir, img))
相关标签
About Me
XD
Goals determine what you are going to be.
Category
标签云
Nginx JSON Jupyter Claude Quantize AI Paper ResNet-50 ModelScope Algorithm 多进程 阿里云 CUDA Hungarian UNIX Dataset Django GGML LLAMA InvalidArgumentError CV 多线程 IndexTTS2 Proxy Plotly CSV RGB Git 公式 Template Qwen Augmentation BeautifulSoup ChatGPT Attention Input Clash Image2Text WebCrawler PDB XGBoost Hotel Conda TensorRT 继承 Pytorch Land GIT Markdown UI Cloudreve 证件照 tar Paddle Translation Bert transformers Logo TensorFlow PyCharm Crawler uwsgi Sklearn Domain git BF16 Magnet TSV Github C++ Mixtral 域名 NameSilo Food Jetson Shortcut Bitcoin Vmess Anaconda CC API Freesound Heatmap Transformers Vim 财报 OCR Tiktoken GPTQ Breakpoint FastAPI Pillow Card hf v2ray 版权 Quantization COCO Firewall 报税 SAM 飞书 Video QWEN Diagram FP8 Pickle CTC Data SQL printf Docker Review Safetensors HaggingFace Website CAM CLAP ONNX TTS PDF LLM Miniforge Disk HuggingFace Bipartite uWSGI v0.dev Interview Qwen2.5 Gemma git-lfs Color Llama XML torchinfo Animate NLTK Statistics PyTorch Michelin Datetime DeepSeek VGG-16 FP64 视频信息 FP16 Zip diffusers tqdm Excel MD5 搞笑 Ubuntu Base64 腾讯云 Knowledge PIP logger LeetCode RAR Linux Google Plate Windows Streamlit NLP Tracking VSCode VPN CEIR Baidu Use 关于博主 Web OpenCV Permission mmap Tensor Pandas SQLite Random llama.cpp Qwen2 Hilton 净利润 BTC Password Distillation WAN Ptyhon LoRA Numpy 算法题 SPIE Bin YOLO Python DeepStream Math GoogLeNet 签证 FlashAttention EXCEL GPT4 scipy SVR LaTeX OpenAI FP32 音频
站点统计

本站现有博文311篇,共被浏览740153

本站已经建立2377天!

热门文章
文章归档
回到顶部