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

本站现有博文335篇,共被浏览937406

本站已经建立2648天!

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