Pillow ImageOps.expand 为图像加border
        【摘要】 所属的课程名称及链接[AI基础课程--常用框架工具]环境信息* ModelArts  * Notebook - Multi-Engine 2.0 (python3)    * JupyterLab - Notebook - Conda-python3      * Pillow 5.0.0Pillow ImageOps.expand 为图像加border%matplotlib inlinef...
    
    
    
    所属的课程名称及链接
环境信息
- * ModelArts 
  -   * Notebook - Multi-Engine 2.0 (python3) 
    -     * JupyterLab - Notebook - Conda-python3 
      - * Pillow 5.0.0
 
 
-     * JupyterLab - Notebook - Conda-python3 
      
 
-   * Notebook - Multi-Engine 2.0 (python3) 
    
Pillow ImageOps.expand 为图像加border
%matplotlib inline
from PIL import Image
import matplotlib.pyplot as plt
img = Image.open('image.png')
plt.imshow(img)<matplotlib.image.AxesImage at 0x7f9564f3c550>
from PIL import ImageOps
img_expand = ImageOps.expand(img,border=(10,50,100,150),fill="yellow")
plt.imshow(img_expand)<matplotlib.image.AxesImage at 0x7f95643f9320>
help
help(ImageOps.expand)
Help on function expand in module PIL.ImageOps:
expand(image, border=0, fill=0)
    Add border to the image
    
    :param image: The image to expand.
    :param border: Border width, in pixels.
    :param fill: Pixel fill value (a color value).  Default is 0 (black).
    :return: An image.备注
 1. 感谢老师的教学与课件  
 
2. 欢迎各位同学一起来交流学习心得^_^
3. 沙箱实验、认证、论坛和直播,其中包含了许多优质的内容,推荐了解与学习。
2. 欢迎各位同学一起来交流学习心得^_^
3. 沙箱实验、认证、论坛和直播,其中包含了许多优质的内容,推荐了解与学习。
            【声明】本内容来自华为云开发者社区博主,不代表华为云及华为云开发者社区的观点和立场。转载时必须标注文章的来源(华为云社区)、文章链接、文章作者等基本信息,否则作者和本社区有权追究责任。如果您发现本社区中有涉嫌抄袭的内容,欢迎发送邮件进行举报,并提供相关证据,一经查实,本社区将立刻删除涉嫌侵权内容,举报邮箱:
                cloudbbs@huaweicloud.com
                
            
        
        
        
        
        
        
        - 点赞
- 收藏
- 关注作者
 
             
           
评论(0)