from PIL import Image
    from PIL import ImageColor
    
    # 创建图像
    createdImg = Image.new('RGBA', (5, 5), 'purple')
    createdImg.save('test.jpg')
    
    # 加载图片
    img = Image.open('img.jpg')
    
    print(img.size)
    print(img.filename)
    print(img.format)
    print(img.format_description)
    
    # 图片裁剪
    croppedImg = img.crop((10, 12, 33, 55))
    croppedImg.save('croppedImg.jpg')
    
    # 图片拷贝和粘贴
    copyImg = croppedImg.copy()
    copyImg.paste(createdImg, (0,0))
    copyImg.save('paste.png')
    
    # 调整图像大小
    width, height = img.size
    svelteImg = img.resize((int(width/2), int(height/2)))
    svelteImg.save('svelteImg.png')
    
    # 旋转图像
    img.rotate(90).save('rotated.png')
    
    # 镜像翻转
    img.transpose(Image.FLIP_LEFT_RIGHT).save('horizontal_flip.png')
    img.transpose(Image.FLIP_TOP_BOTTOM).save('vertical_flip.png')
    
    # 修改单个像素
    img = Image.new('RGBA', (100, 100))
    for x in range(100):
        for y in range(50):
            img.putpixel((x, y), ImageColor.getcolor('darkgray', 'RGBA'))
    img.save('putPixel.png')