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

本站现有博文320篇,共被浏览756683

本站已经建立2421天!

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