Example #1
0
def __getreturn(src, dst):
    if isinstance(src, Graphic):
        src.getShape().setImage(dst)
        return src
    elif isinstance(src, MILayer):
        src.layer.setImage(dst)
        return src
    elif isinstance(src, MIArray):
        r = ImageUtil.imageRead(dst)
        return MIArray(r)
    else:
        return dst
Example #2
0
def imread(fname):
    '''
    Read RGB(A) data array from image file.
    
    :param fname: (*String*) Image file name.
    
    :returns: (*array*) RGB(A) data array.
    '''
    if not os.path.exists(fname):
        raise IOError(fname)
    r = ImageUtil.imageRead(fname)
    return NDArray(r)
Example #3
0
def imread(fname):
    '''
    Read RGB(A) data array from image file.
    
    :param fname: (*String*) Image file name.
    
    :returns: (*array*) RGB(A) data array.
    '''
    if not os.path.exists(fname):
        raise IOError(fname)
    r = ImageUtil.imageRead(fname)
    return MIArray(r)
Example #4
0
def __getreturn(src, dst):
    if isinstance(src, Graphic):
        src.getShape().setImage(dst)
        return src
    elif isinstance(src, MILayer):
        src.layer.setImage(dst)
        return src
    elif isinstance(src, MIArray):
        r = ImageUtil.imageRead(dst)
        return MIArray(r)
    else:
        return dst
Example #5
0
def gifread(gif, frame=0):
    '''
    Read RGB(A) data array from a gif image file or a gif decoder object.
    
    :param gif: (*string or GifDecoder*) Gif image file or gif decoder object.
    :param frame: (*int*) Image frame index.
    
    :returns: (*array*) RGB(A) data array.
    '''
    if isinstance(gif, basestring):
        gif = gifopen(gif)
    im = gif.getFrame(frame)
    r = ImageUtil.imageRead(im)
    return NDArray(r)
Example #6
0
def gifread(gif, frame=0):
    '''
    Read RGB(A) data array from a gif image file or a gif decoder object.
    
    :param gif: (*string or GifDecoder*) Gif image file or gif decoder object.
    :param frame: (*int*) Image frame index.
    
    :returns: (*array*) RGB(A) data array.
    '''
    if isinstance(gif, basestring):
        gif = gifopen(gif)
    im = gif.getFrame(frame)
    r = ImageUtil.imageRead(im)
    return MIArray(r)