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

本站现有博文321篇,共被浏览774205

本站已经建立2464天!

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