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

本站现有博文332篇,共被浏览877827

本站已经建立2584天!

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