image_Magic图片处理功能

#亮度对比度 [-100,100]
brightness = re.search(r'_[-]*[0-9]+b', style_list)
#锐化 [50, 399]
sharpen = re.search(r'[0-9]+sh', style_list)
#模糊效果 radius取值在 [1,50], radius越大,越模糊 sigma取值 [1,50],越大,越模糊 [radius]-[sigma]bl
blur = re.search(r'[0-9]-[0-9]bl', style_list)
# watermark = 2 & type = d3F5LXplbmhlaQ & size = 40 & text = SGVsbG8g5Zu - 54
# mH5pyN5YqhIQ & color = I0ZGRkZGRg & t = 50 & p = 6 & x = 10 & voffset = 20
# 1:图片水印 2:文字水印 3:文图混合水印
watermark = re.search(r'watermark=[0-9]', style_list)
#垂直边距, 就是距离图片边缘的垂直距离[0 – 4096]
y = re.search(r'y=[0-9]+',style_list)
#中线垂直偏移[-1000, 1000]
voffset = re.search(r'voffset=[-]*[0-9]+',style_list)
#水平边距 [0 – 4096]
x = re.search(r'x=[0-9]+', style_list)
#水印打在图的位置 [1-9]
p = re.search(r'p=[0-9]+', style_list)
#透明度 [0-100]
t = re.search(r't=[0-9]+', style_list)
#表示文字水印的文字内容(必须编码) 是URL安全base64编码 encodeText = url_safe_base64_encode(fontText) 最大长度为64个字符(即支持汉字最多20个左右)
text = re.search(r'text=[0-9a-zA-Z-_]+', style_list)
#表示文字水印的文字类型(必须编码) 须是URL安全base64编码 encodeText = url_safe_base64_encode(fontType) wqy-zenhei ( 编码后的值:d3F5LXplbmhlaQ)
type =re.search(r'type=[0-9a-zA-Z=]+', style_list)
#文字水印文字的颜色(必须编码)
#color=I0ZGRkZGRg
color = re.search(r'color=')
if type:
dic['type'] = type.group()[5:]
print dic['type']
if text:
dic['text'] = text.group()[5:]
if t:
dic['t'] = t.group()[2:]
if p:
dic['p'] = p.group()[2:]
if x:
dic['x'] = x.group()[2:]
if voffset:
dic['voffset'] = voffset.group()[8:]
if y:
dic['y'] = y.group()[2:]
if watermark:
dic['watermark'] = watermark.group()[-1]
if blur:
dic['blur'] = blur.group()[:-2]
if sharpen:
dic['sharpen'] = sharpen.group()[:-2]
if brightness:
dic['brightness'] = brightness.group()[1:]




posted @ 2016-08-14 13:35  意发并行  阅读(543)  评论(0编辑  收藏  举报