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

本站现有博文337篇,共被浏览963829次

本站已经建立2676天!

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