Example #1
0
def test_array_creation():
    arr = np.array([[0, 1, 2], [3, 4, 0], [1, 2, 3], [4, 0, 1]],
                   dtype=np.uint8)

    img = py_gd.from_array(arr)

    img.save('junk.bmp')

    for y in range(img.height):
        for x in range(img.width):
            assert arr[y, x] == img.get_pixel_value((x, y))
Example #2
0
def test_array_creation():
    arr = np.array([[0, 1, 2], [3, 4, 5], [6, 7, 8], [9, 10, 11]],
                   dtype=np.uint8,
                   order='c')

    img = py_gd.from_array(arr)

    img.save(outfile('test_image_array2.bmp'))

    for y in range(img.height):
        for x in range(img.width):
            assert arr[x, y] == img.get_pixel_value((x, y))
Example #3
0
def test_array_creation():
    arr = np.array( [[ 0, 1, 2],
                     [ 3, 4, 0],
                     [ 1, 2, 3],
                     [ 4, 0, 1] ],
                     dtype=np.uint8)
 
    img = py_gd.from_array(arr)
    
    img.save('junk.bmp')

    for y in range(img.height):
        for x in range(img.width):
            assert arr[y,x] == img.get_pixel_value( (x,y) )
Example #4
0
def test_array_creation():
    arr = np.array([[0, 1, 2],
                    [3, 4, 5],
                    [6, 7, 8],
                    [9, 10, 11]],
                   dtype=np.uint8,
                   order='c')

    img = py_gd.from_array(arr)

    img.save(outfile('test_image_array2.bmp'))

    for y in range(img.height):
        for x in range(img.width):
            assert arr[x, y] == img.get_pixel_value((x, y))