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
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)
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)
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)
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)