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
标签云
Qwen2 PIP mmap Domain Qwen2.5 LeetCode 飞书 多线程 CUDA 第一性原理 OpenAI 搞笑 Template WAN Augmentation Permission YOLO Transformers NLP SPIE Translation uWSGI SQLite Claude ms-swift 关于博主 Land Zip CC VGG-16 Jetson PyTorch Data Web Tensor Miniforge VSCode 版权 scipy 域名 RAR v2ray VPN LaTeX Diagram ResNet-50 Distillation 继承 Windows FP16 PDB GPTQ 图形思考法 Ubuntu C++ 算法题 Card CSV Statistics SVR GGML ONNX Attention Shortcut Qwen NLTK Anaconda CAM FastAPI Random 财报 printf 腾讯云 图标 论文 tar GPT4 Use Magnet Tracking Freesound 云服务器 报税 Baidu logger 递归学习法 Paper IndexTTS2 Quantize FP64 git-lfs Nginx Color Crawler Food Numpy 音频 COCO Breakpoint llama.cpp OpenCV Animate XGBoost Conda v0.dev 证件照 WebCrawler Hotel 论文速读 Plate Interview Heatmap 签证 Search FlashAttention InvalidArgumentError 阿里云 多进程 GoogLeNet Math Hungarian UNIX Vmess ModelScope BeautifulSoup Datetime Llama Password TSV Python TTS BF16 Docker git SAM Pillow Pickle Proxy Vim Quantization SQL CTC Jupyter Bin API Paddle 强化学习 HuggingFace Rebuttal GIT MD5 Hilton Base64 Ptyhon Git 顶会 FP8 Video Pandas 净利润 Knowledge OCR uwsgi torchinfo PDF Plotly Streamlit Firewall UI Cloudreve LLAMA Michelin Logo DeepSeek DeepStream XML PyCharm tqdm Tiktoken transformers Review Disk hf CEIR Bipartite TensorRT Bitcoin NameSilo Sklearn icon Agent LoRA Input RL Markdown News JSON Django Excel Safetensors QWEN Google RGB CLAP EXCEL ChatGPT Algorithm BTC CV Website Gemma FP32 Dataset Bert 公式 Pytorch Mixtral Github Image2Text Linux AI diffusers HaggingFace LLM Clash TensorFlow
站点统计

本站现有博文333篇,共被浏览913641

本站已经建立2616天!

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