def get_avatar( name= '' ) :
gr = Image.new ( 'RGB' , ( 261 , 261 ) , ( 0 , 0 , 0 ) )
x = 1
y = 1
x1 = 65
y1 = 65
for dx in range ( 0 , 4 ) :
for dy in range ( 0 , 4 ) :
r = randint( 0 , 255 )
g = randint( 0 , 255 )
b = randint( 0 , 255 )
block = Image.new ( 'RGB' , ( 64 , 64 ) , ( r, g, b) )
area = ( x, y, x1, y1)
gr.paste ( block, area)
x+= 65
x1+= 65
x = 1
x1 = 65
y+= 65
y1+= 65
if name == '' :
name = ( '' .join ( sample( '' .join ( [ chr ( i) for i in range ( 97 , 123 ) ] ) *10
+ str ( randint( 11111 , 99999 ) ) *10 , 8 ) ) ) +'.jpg'
gr.save ( name)
if __name__== '__main__' :
from PIL import Image
from random import randint, sample
get_avatar( )
ZGVmIGdldF9hdmF0YXIobmFtZT0nJyk6CiAgICBnciA9IEltYWdlLm5ldygnUkdCJywoMjYxLCAyNjEpLCAoMCwgMCwgMCkpCiAgICB4ID0gMQogICAgeSA9IDEKICAgIHgxID0gNjUKICAgIHkxID0gNjUKICAgIGZvciBkeCBpbiByYW5nZSgwLCA0KToKICAgICAgICBmb3IgZHkgaW4gcmFuZ2UoMCwgNCk6CiAgICAgICAgICAgIHIgPSByYW5kaW50KDAsIDI1NSkKICAgICAgICAgICAgZyA9IHJhbmRpbnQoMCwgMjU1KQogICAgICAgICAgICBiID0gcmFuZGludCgwLCAyNTUpCiAgICAgICAgICAgIGJsb2NrID0gSW1hZ2UubmV3KCdSR0InLCg2NCwgNjQpLCAociwgZywgYikpCiAgICAgICAgICAgIGFyZWEgPSAoeCwgeSwgeDEsIHkxKQogICAgICAgICAgICBnci5wYXN0ZShibG9jaywgYXJlYSkKICAgICAgICAgICAgeCs9NjUKICAgICAgICAgICAgeDErPTY1CiAgICAgICAgeCA9IDEKICAgICAgICB4MSA9IDY1CiAgICAgICAgeSs9NjUKICAgICAgICB5MSs9NjUKICAgIGlmIG5hbWUgPT0gJyc6CiAgICAgICAgbmFtZSA9ICgnJy5qb2luKHNhbXBsZSgnJy5qb2luKFtjaHIoaSkgZm9yIGkgaW4gcmFuZ2UoOTcsIDEyMyldKSoxMAogICAgICAgICAgICAgICAgICAgICAgICAgICArIHN0cihyYW5kaW50KDExMTExLCA5OTk5OSkpKjEwLCA4KSkpKycuanBnJwogICAgZ3Iuc2F2ZShuYW1lKSAgIAoKaWYgX19uYW1lX189PSdfX21haW5fXyc6CiAgICBmcm9tIFBJTCBpbXBvcnQgSW1hZ2UKICAgIGZyb20gcmFuZG9tIGltcG9ydCByYW5kaW50LCBzYW1wbGUKICAgIGdldF9hdmF0YXIoKQ==
stdout
stderr
Traceback (most recent call last):
File "./prog.py", line 29, in <module>
File "./prog.py", line 24, in get_avatar
File "/usr/lib/python3/dist-packages/PIL/Image.py", line 1679, in save
fp = builtins.open(fp, "wb")
PermissionError: [Errno 13] Permission denied: 'ti6wks9j.jpg'