Friend full head
Words don't say much, directly on the code
Import Itchatimport Mathimport PIL. Image as Imageimport ositchat.auto_login () friends = Itchat.get_friends (update=true) [0:]user = friends[0]["UserName"] num = 0for i in Friends: img = itchat.get_head_img (username=i["UserName"]) fileimage = open (' folder ' + '/' + str (num) + ". jpg", ' WB ') Fileimage.write (img) fileimage.close () num + = 1ls = Os.listdir (' folder ') each_size = Int ( Math.sqrt (float (640*640)/len (LS))) lines = Int (640/each_size) image = Image.new (' RGBA ', (640, 640)) x = 0y = 0for i in range ( 0,len (LS) +1): try: img = image.open (' folder ' + '/' + str (i) + ". jpg") except Ioerror:print ("Error") Else: img = IM G.resize ((Each_size, each_size), Image.antialias) Image.paste (IMG, (x * each_size, Y * each_size)) x + = 1if x = = lines: x = 0y + = 1image.save (' folder ' + '/' + ' all.jpg ') itchat.send_image (' folder ' + '/' + ' all.jpg ', ' filehelper ')
Code run requires two libraries to be installed
Pip Install Itchatpip Install Pillow
If the PIP installation option does not tick when you install Python, install PIP first.
Installation of Python and Pip
Itchat Official Introduction
When the code runs, you will see the log-in QR code, and with a sweep, you can view the progress of the process. Your file transfer Assistant will receive a good picture of your avatar.
You are welcome to join the Learning Exchange Group if you encounter any problems or want to acquire learning resources in the learning process.