def imfilter(arr, ftype):
 _tdict = {'blur': ImageFilter.BLUR, 'contour': ImageFilter.CONTOUR, 'detail': ImageFilter.DETAIL, 'edge_enhance': ImageFilter.EDGE_ENHANCE, 'edge_enhance_more': ImageFilter.EDGE_ENHANCE_MORE, 'emboss': ImageFilter.EMBOSS, 'find_edges': ImageFilter.FIND_EDGES, 'smooth': ImageFilter.SMOOTH, 'smooth_more': ImageFilter.SMOOTH_MORE, 'sharpen': ImageFilter.SHARPEN}
 im = toimage(arr)
 if (ftype not in _tdict):
  raise ValueError('Unknown filter type.')
 return fromimage(im.filter(_tdict[ftype]))

def imfilter ( arr , ftype ) : _tdict = { 'blur' : ImageFilter . BLUR , 'contour' : ImageFilter . CONTOUR , 'detail' : ImageFilter . DETAIL , 'edge_enhance' : ImageFilter . EDGE_ENHANCE , 'edge_enhance_more' : ImageFilter . EDGE_ENHANCE_MORE , 'emboss' : ImageFilter . EMBOSS , 'find_edges' : ImageFilter . FIND_EDGES , 'smooth' : ImageFilter . SMOOTH , 'smooth_more' : ImageFilter . SMOOTH_MORE , 'sharpen' : ImageFilter . SHARPEN } im = toimage ( arr ) if ( ftype not in _tdict ) : raise ValueError ( 'Unknown filter type.' ) return fromimage ( im . filter ( _tdict [ ftype ] ) )
simple filtering of an image .