Example #1
0
def test_identify_size():
    img = Image.read(util.find_image("eye.gif"))

    assert len(img) == 1, "one frame"
    assert img.original_format == "GIF", "image is a gif"  # XXX this should be a magick format object
    assert img.size == Size(32, 32), "dimensions are 32x32"

    frame = img[0]
    assert frame.canvas.position == Vector(0, 0), "virtual canvas has no offset"
    assert not frame.canvas.position, "virtual canvas offset registers as false"
    assert frame.canvas.size == Size(32, 32), "virtual canvas is 32x32"
    assert frame.canvas.size == img.size, "virtual canvas size is image size"
    assert not frame.has_canvas, "frame isn't using a virtual canvas"
    assert not img.has_canvas, "image isn't using a virtual canvas"
Example #2
0
def test_pixel_iter():
    """Does iterating over pixels appear to work?"""
    img = Image.read(util.find_image('terminal.gif'))
    pixel_iter = iter(img[0].pixels)

    white = RGBColor(1., 1., 1.)

    px = next(pixel_iter)
    assert px.point == Vector(0, 0)
    assert px.color == white

    px = next(pixel_iter)
    assert px.point == Vector(1, 0)
    assert px.color == white
Example #3
0
def test_pixel_iter():
    """Does iterating over pixels appear to work?"""
    img = Image.read(util.find_image('terminal.gif'))
    pixel_iter = iter(img[0].pixels)

    white = RGBColor(1., 1., 1.)

    px = next(pixel_iter)
    assert px.point == Vector(0, 0)
    assert px.color == white

    px = next(pixel_iter)
    assert px.point == Vector(1, 0)
    assert px.color == white
Example #4
0
def test_pixel_get():
    """Does random pixel inspection work?"""
    img = Image.read(util.find_image('terminal.gif'))
    assert img[0].pixels[11, 6] == RGBColor(1., 0., 0.)
Example #5
0
def test_pixel_get():
    """Does random pixel inspection work?"""
    img = Image.read(util.find_image('terminal.gif'))
    assert img[0].pixels[11, 6] == RGBColor(1., 0., 0.)