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

本站现有博文333篇,共被浏览922701

本站已经建立2628天!

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