我们从Python开源项目中,提取了以下2个代码示例,用于说明如何使用PIL.ImageFilter.EMBOSS。
def apply_effects(image, effects): """method to apply effects to original image from list of effects """ for effect in effects: gray = ImageOps.grayscale(image) # dictionary with all the availble effects all_effects = { 'BLUR': image.filter(ImageFilter.BLUR), 'CONTOUR': image.filter(ImageFilter.CONTOUR), 'EMBOSS': image.filter(ImageFilter.EMBOSS), 'SMOOTH': image.filter(ImageFilter.SMOOTH), 'HULK': ImageOps.colorize(gray, (0, 0, 0, 0), '#00ff00'), 'FLIP': ImageOps.flip(image), 'MIRROR': ImageOps.mirror(image), 'INVERT': ImageOps.invert(image), 'SOLARIZE': ImageOps.solarize(image), 'GREYSCALE': ImageOps.grayscale(image), } phedited = all_effects[effect] image = phedited return phedited
def emboss(message, im): """ Applies a emboss effect. Example:: /drawtext Hello there! | emboss Requires an input image. """ return im.filter(ImageFilter.EMBOSS)