PIL Image

作者: 谢小帅 | 来源:发表于2019-02-13 20:51 被阅读3次
    from PIL import Image
    import numpy as np
    
    img = Image.open('/temp_disk/xs/sun/train/image/0.jpg')
    print(img.format)  # JPEG
    print(img.mode)  # RGB
    print(img.size)
    print(img.info)  # a dict
    img = np.array(img)
    print(np.min(img))  # 3
    print(np.max(img))  # 255
    print()
    
    depth = Image.open('/temp_disk/xs/sun/train/depth/0.png')
    print(depth.format)  # PNG
    print(depth.mode)  # I
    print(depth.size)
    print(depth.info)
    depth = np.array(depth)
    print(np.min(depth))  # 8784
    print(np.max(depth))  # 52456
    
    JPEG
    RGB
    (730, 530)
    {'jfif': 257, 'jfif_version': (1, 1), 'jfif_unit': 0, 'jfif_density': (1, 1)}
    3
    255
    
    PNG
    I
    (730, 530)
    {}
    8784
    52456
    

    相关文章

      网友评论

          本文标题:PIL Image

          本文链接:https://www.haomeiwen.com/subject/evljeqtx.html