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

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

本站已经建立2534天!

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