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

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

本站已经建立2443天!

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