我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用PIL.ImageFilter.SMOOTH_MORE。
def image_filter(img): for i in range(10): img = img.filter(ImageFilter.SMOOTH_MORE) return img
def call(self, img): if img is None: raise ValueError('img is None') im_n = img.copy() gauss_blur_low, gauss_blur_high = 0, self.gauss_blur blur_low, blur_high = gauss_blur_high, gauss_blur_high + self.blur smooth_low, smooth_high = blur_high, blur_high + self.smooth smooth_more_low, smooth_more_high = smooth_high, smooth_high + self.smooth_more rank_low, rank_high = smooth_more_high, smooth_more_high + self.rank_filter r = random() if gauss_blur_low <= r <= gauss_blur_high: im_n = im_n.filter(ImageFilter.GaussianBlur(1)) elif blur_low < r <= blur_high: im_n = im_n.filter(ImageFilter.BLUR) elif smooth_low < r <= smooth_high: im_n = im_n.filter(ImageFilter.SMOOTH) elif smooth_more_low < r <= smooth_more_high: im_n = im_n.filter(ImageFilter.SMOOTH_MORE) elif rank_low < r <= rank_high: im_n = im_n.filter(ImageFilter.RankFilter(size=3, rank=7)) else: pass return im_n