Exemple #1
0
def test_resize_image_aspect_ratio():
    """make sure the aspect-ratio is maintained"""
    from PIL import Image
    img = Image.new('RGB', (100, 200))

    img2 = coverlib.resize_image(img, (40, 40))
    assert img2.size == (20, 40)

    img2 = coverlib.resize_image(img, (400, 400))
    assert img2.size == (100, 200)

    img2 = coverlib.resize_image(img, (75, 100))
    assert img2.size == (50, 100)

    img2 = coverlib.resize_image(img, (75, 200))
    assert img2.size == (75, 150)
def test_resize_image_aspect_ratio():
    """make sure the aspect-ratio is maintained"""
    import Image
    img = Image.new('RGB', (100, 200))
    
    img2 = coverlib.resize_image(img, (40, 40))
    assert img2.size == (20, 40)

    img2 = coverlib.resize_image(img, (400, 400))
    assert img2.size == (100, 200)
    
    img2 = coverlib.resize_image(img, (75, 100))
    assert img2.size == (50, 100)
    
    img2 = coverlib.resize_image(img, (75, 200))
    assert img2.size == (75, 150)