对指定图片实现滤镜特效和明暗亮度的变化。

2022-05-28 15:56:52 浏览数 (1)

代码语言:javascript复制
from PIL import Image,ImageFilter

imga=Image.open(r'C:UsersxppDesktoplena.jpg')
w,h=imga.size 
img_output=Image.new('RGB',(2*w,h))

img_output.paste(imga,(0,0))

fltrs=[]
fltrs.append(ImageFilter.EDGE_ENHANCE)

fltrs.append(ImageFilter.FIND_EDGES)

fltrs.append(ImageFilter.GaussianBlur)

for fltr in fltrs:

from PIL import Image
from PIL import ImageChops,ImageEnhance

imga=Image.open(r'C:UsersxppDesktoplena.jpg') 
w,h=imga.size

img_output=Image.new('RGB',(2*w,h))

img_output.paste(imga,(0,0))

nhc=ImageEnhance.Color(imga)
for ratio in [0.6,1.8]:
    b=nhc.enhance(ratio)

    img_output.paste(b,(w,0))
  
    img_output.show()
    
from PIL import Image
from PIL import ImageChops,ImageEnhance

imga=Image.open(r'C:UsersxppDesktoplena.jpg') 
w,h=imga.size

img_output=Image.new('RGB',(2*w,h))

img_output.paste(imga,(0,0))

nhb=ImageEnhance.Brightness(imga)
for ratio in [0.6,1.8]:
  
    b=nhb.enhance(ratio)
  
    img_output.paste(b,(w,0))

img_output.show()

from PIL import Image

imga=Image.open(r'C:UsersxppDesktoplena.jpg') 
w,h=imga.size

img_output=Image.new('RGB',(3*w,h))

img_output.paste(imga,(0,0))
imgb=imga.point(lambda i:i*1.3) 
img_output.paste(imgb,(w,0)) 
imgc=imga.point(lambda i:i*0.4) 
img_output.paste(imgc,(2*w,0))
img_output.show()
代码语言:javascript复制
from PIL import Image,ImageFilter

imga=Image.open(r'C:UsersxppDesktoplena.jpg')
w,h=imga.size 
img_output=Image.new('RGB',(2*w,h))

img_output.paste(imga,(0,0))

fltrs=[]
fltrs.append(ImageFilter.EDGE_ENHANCE)

fltrs.append(ImageFilter.FIND_EDGES)

fltrs.append(ImageFilter.GaussianBlur)

for fltr in fltrs:

from PIL import Image
from PIL import ImageChops,ImageEnhance

imga=Image.open(r'C:UsersxppDesktoplena.jpg') 
w,h=imga.size

img_output=Image.new('RGB',(2*w,h))

img_output.paste(imga,(0,0))

nhc=ImageEnhance.Color(imga)
for ratio in [0.6,1.8]:
    b=nhc.enhance(ratio)

    img_output.paste(b,(w,0))
  
    img_output.show()
    
from PIL import Image
from PIL import ImageChops,ImageEnhance

imga=Image.open(r'C:UsersxppDesktoplena.jpg') 
w,h=imga.size

img_output=Image.new('RGB',(2*w,h))

img_output.paste(imga,(0,0))

nhb=ImageEnhance.Brightness(imga)
for ratio in [0.6,1.8]:
  
    b=nhb.enhance(ratio)
  
    img_output.paste(b,(w,0))

img_output.show()

from PIL import Image

imga=Image.open(r'C:UsersxppDesktoplena.jpg') 
w,h=imga.size

img_output=Image.new('RGB',(3*w,h))

img_output.paste(imga,(0,0))
imgb=imga.point(lambda i:i*1.3) 
img_output.paste(imgb,(w,0)) 
imgc=imga.point(lambda i:i*0.4) 
img_output.paste(imgc,(2*w,0))
img_output.show()

0 人点赞