Beispiel #1
0
def test_no_resize():
    img = Image.new('RGB', (40, 20))
    img = resize_image(img, "100x100")
    width, height = img.size
    assert width == 40
    assert height == 20

    img = Image.new('RGB', (40, 20))
    img = resize_image(img, "100x100^")
    width, height = img.size
    assert width == 40
    assert height == 20
Beispiel #2
0
def test_exactsize():
    img = Image.new('RGB', (6912, 3456))
    img = resize_image(img, "600_x5000")
    width, height = img.size
    assert width == 600
    assert height == 300

    img = Image.new('RGB', (60, 20))
    img = resize_image(img, "10_x10")
    width, height = img.size
    assert width == 10
    assert height == 3

    img = Image.new('RGB', (10, 20))
    img = resize_image(img, "10_x10")
    width, height = img.size
    assert width == 10
    assert height == 10

    img = Image.new('RGB', (60, 20))
    img = resize_image(img, "10x10_")
    width, height = img.size
    assert width == 10
    assert height == 10

    img = Image.new('RGB', (20, 60))
    img = resize_image(img, "10x10_")
    width, height = img.size
    assert width == 3
    assert height == 10

    img = Image.new('RGB', (20, 60))
    img = resize_image(img, "10_x10_")
    width, height = img.size
    assert width == 10
    assert height == 10

    img = Image.new('RGB', (20, 60))
    img = resize_image(img, "100_x100_")
    width, height = img.size
    assert width == 100
    assert height == 100
Beispiel #3
0
def test_minsize():
    img = Image.new('RGB', (60, 20))
    img = resize_image(img, "10_x10")
    width, height = img.size
    assert width == 30
    assert height == 10

    img = Image.new('RGB', (10, 20))
    img = resize_image(img, "10_x10")
    width, height = img.size
    assert width == 10
    assert height == 10

    img = Image.new('RGB', (60, 20))
    img = resize_image(img, "10x10_")
    width, height = img.size
    assert width == 10
    assert height == 10

    img = Image.new('RGB', (20, 60))
    img = resize_image(img, "10x10_")
    width, height = img.size
    assert width == 10
    assert height == 30

    img = Image.new('RGB', (20, 60))
    img = resize_image(img, "10_x10_")
    width, height = img.size
    assert width == 10
    assert height == 30

    img = Image.new('RGB', (20, 60))
    img = resize_image(img, "100_x100_")
    width, height = img.size
    assert width == 100
    assert height == 100
Beispiel #4
0
def test_crop():
    img = Image.new('RGB', (40, 20))
    img = resize_image(img, "10x10^")
    width, height = img.size
    assert width == 10
    assert height == 10