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

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

本站已经建立2474天!

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