#!/usr/bin/python
#coding=utf-8
import Image,ImageDraw,ImageFont,os,string,random,ImageFilter
def initChars():
"""
ÔÊÐíµÄ×Ö·û¼¯ºÏ£¬³õʼ¼¯ºÏΪÊý×Ö¡¢´óСд×Öĸ
usage: initChars()
param: None
return: list
·µ»ØÔÊÐíµÄ×Ö·û¼¯ºÍ
for: picCheckerÀà³õʼ×Ö·û¼¯ºÏ
todo: Nothing
"""
nums = [str(i) for i in range(10)]
letterCase = [
'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'j', 'k',
'm', 'n', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y'
]
upperCase = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'J', 'K',
'M', 'N', 'P', 'Q', 'R', 'S', 'T', 'U', 'V',
'W', 'X', 'Y'
]
return(nums+letterCase+upperCase)
class picChecker():
"""
ͼƬÑéÖ¤´úÂ룺
1) Óû§×¢²áÐèÌîдͼƬÑéÖ¤Â룬ÒÔ×èÖ¹»úÆ÷ÈË×¢²á
2) ͼƬÑéÖ¤Âë×Ö·ûÊýΪ 4 λ(´óСд×ÖĸÓëÊý×Ö£¬²»Çø·Ö´óСд)¡£
Óû§Èç¹ûûÓÐÌîдÑéÖ¤Âë»òûÓÐÌîдÕýÈ·µÄÑéÖ¤Â룬
Ò³ÃæÓѺÃÐÔÌáʾÓû§Ìîд(ͬʱ³ÌÐò·½ÃæÒ²×öÏàÓ¦ÏÞÖÆ)
usage: pc = picChecker().createChecker()
param: ºÜ¶à£¬ÈçÏÂ
chars ÔÊÐíµÄ×Ö·û¼¯ºÏ£¬
ÀàÐÍ list
ĬÈÏÖµ initChars()
Àý×Ó ['1','2','3']
length ×Ö·û´®³¤¶È
ÀàÐÍ integer
ĬÈÏÖµ 4
size ͼƬ´óС
ÀàÐÍ tutle
ĬÈÏÖµ (120,30)
Àý×Ó (120,30)
fontsize ×ÖÌå´óС
ÀàÐÍ integer
ĬÈÏÖµ 25
begin ×Ö·ûÆäʵλÖ㬼´×óÉϽÇλÖÃ
ÀàÐÍ tutle
ĬÈÏÖµ (5,-2)
outputType Êä³öÀàÐÍ
ÀàÐÍ string
ĬÈÏÖµ GIF
¿ÉÑ¡Öµ GIF JPEG TIFF PNG
mode ͼƬģʽ
ÀàÐÍ string
¿ÉÑ¡Öµ RGB L (»¹ÓÐÆäËûģʽ£¬µ«Ö»ÍƼöÕâ2ÖÖ)
ĬÈÏÖµ RGB
backgroundColor ±³¾°É«
foregroundColor Ç°¾°É«
µ±mode=RGBʱ£¬backgroundColor,foregroundColorΪtutleÀàÐÍ
ȡֵΪ(integer,integer,integer)
±íʾRGBÑÕÉ«Öµ
µ±mode=Lʱ£¬backgroundColor,foregroundColorΪÊý×Ö£¬±íʾºÚ°×ģʽ
ȡֵΪ0-255
±íʾ»Ò¶È
fonttype ×ÖÌå·¾¶
ÀàÐÍ string
ĬÈÏÖµ "simsum.ttc"
jamNum ¸ÉÈÅÏßÌõÊý
ÀàÐÍ (int1,int1)
int1 ¸ÉÈÅÏßÌõÊýÏÂÏÞ£¬°üº¬
int2 ¸ÉÈÅÏßÌõÊý
http://code.google.com/p/shedskin/ Shed Skin 0.3 - support for 3 new standard library modules (now about 20 in total): - itertools (jeremie roquet) - heapq (jeremie roquet) - csv (converted using shedskin) - 4 new example programs (now 44 in total!): - maximum weighted matching al ......