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

本站现有博文327篇,共被浏览826088

本站已经建立2532天!

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