Пример #1
0
def test_imsave():
    fh, tempFilename = tempfile.mkstemp('.png')
    os.close(fh)
    try:
        for filename in all_test_images:
            filename = _locate_test_image(filename)
            a = qimage2ndarray.imread(filename)
            ok = qimage2ndarray.imsave(tempFilename, a)
            assert ok
            b = qimage2ndarray.imread(tempFilename)
            assert_equal(a.shape, b.shape)
            assert numpy.all(a == b)
    finally:
        os.unlink(tempFilename)
Пример #2
0
def test_imsave():
    fh, tempFilename = tempfile.mkstemp('.png')
    os.close(fh)
    try:
        for filename in all_test_images:
            filename = _locate_test_image(filename)
            a = qimage2ndarray.imread(filename)
            ok = qimage2ndarray.imsave(tempFilename, a)
            assert ok
            b = qimage2ndarray.imread(tempFilename)
            assert_equal(a.shape, b.shape)
            assert numpy.all(a == b)
    finally:
        os.unlink(tempFilename)
def test_color_views():
    filename = _locate_test_image('test_colored.jpg')
    for view in (qimage2ndarray.alpha_view,
                 qimage2ndarray.rgb_view,
                 qimage2ndarray.recarray_view):
        assert isinstance(view(filename), numpy.ndarray)
Пример #4
0
def test_color_views():
    filename = _locate_test_image('test_colored.jpg')
    for view in (qimage2ndarray.alpha_view, qimage2ndarray.rgb_view,
                 qimage2ndarray.recarray_view):
        assert isinstance(view(filename), numpy.ndarray)