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

本站现有博文311篇,共被浏览740164

本站已经建立2377天!

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