The No. 0000 question: Add your QQ head (or Weibo avatar) to the top right corner with a red number, similar to the amount of unread information that prompt effect. Similar to the effect in the diagram
The pillow Library in Python is designed to work with images.
1 fromPILImportImage, Imagefont, Imagedraw2 3 defadd_num (size, num):4im = Image.open ('1.jpg')5Font = Imagefont.truetype ('C:/windows/fonts/arial.ttf', size)#Generate Fonts6Draw = Imagedraw.draw (IM)#Build Canvas7W,h =im.size8Draw.pieslice ([(w/4*3,0), (W,H/4)], 0,,, fill ='Red')#This is the picture fan, the front [(x1,y1), (X2,y2)] represents the upper-left corner of the rectangle and the lower-right corner9 #Draw a fan in the rectangular area, 0 is the starting angle, and 360 is the end angleTenDraw.text ((w*0.82, H*1/35), str (num), font = font, fill =' White')#add text, two-tuple is the upper-left corner coordinate OneIm.show ()#open view with default paint software AIm.save ('2.jpg')#Save - -Add_num (150,7)
One small program per day-0000 questions (Python image processing)