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

本站现有博文339篇,共被浏览996014次

本站已经建立2706天!

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