Смотрите видео ниже, чтобы узнать, как установить наш сайт в качестве веб-приложения на домашнем экране.
Примечание: Эта возможность может быть недоступна в некоторых браузерах.
def PIXELATION2(text):
n, table, line_lenght, stroka, list_all = 0, [], [], [], []
text = text.encode("UTF-8")
while len(text) != n:
table.append(text[n])
n +=1
lenf = len(table)
if len(table) % 3 != 0:
while len(table) % 3 != 0:
table.append(random.randrange(1, 255))
leght_s = len(table) // 3
while lenf > 0:
line_lenght.append(((lenf % 256), 0, 0))
lenf = lenf // 256
for k in range(0, (leght_s - len(line_lenght))):
line_lenght.append((0, random.randrange(1, 255), random.randrange(1, 255)))
for i in range(leght_s):
tiple = (table[i*3], table[i*3+1], table[i*3+2])
stroka.append(tiple)
list_all.append(stroka)
list_all.append(line_lenght)
array = np.array(list_all, dtype=np.uint8)
new_image = Image.fromarray(array)
return new_image.save('new' + str(random.randrange(1, 10000000)) + '.png')
## соблюдаем первый и второй законы сразу
if len(table) % 3 != 0:
while len(table) % 3 != 0:
table.append(random.randrange(1, 255))
leght_s = len(table) // 3 ##подумаем о первом законе немнога
while lenf > 0:
line_lenght.append(((lenf % 256), 0, 0))
lenf = lenf // 256
for k in range(0, (leght_s - len(line_lenght))): ## здесь второй закон живет
line_lenght.append((0, random.randrange(1, 255), random.randrange(1, 255)))
## схемка по созданию картинки
for i in range(leght_s):
tiple = (table[i*3], table[i*3+1], table[i*3+2])
stroka.append(tiple)
list_all.append(stroka)
list_all.append(line_lenght)
array = np.array(list_all, dtype=np.uint8)
new_image = Image.fromarray(array)
return new_image.save('new' + str(random.randrange(1, 10000000)) + '.png')
im = Image.open(file_name, 'r')
pixel_values = list(im.getdata())
im.close()
for i in range(len(massive)):
massive1.append(massive[i][0])
massive1.append(massive[i][1])
massive1.append(massive[i][2])
for j in range(lenght*2):
if pixel_values[j][1] == 0 and pixel_values[j][2] == 0 and pixel_values[j][0] != 0:
massive_lenghttrue.append(pixel_values[j][0])
file_out = open('result' + str(random.randrange(1, 10000000)) + '.txt', 'wb')
MassiveByte = bytearray(massive_tr)
file_out.write(MassiveByte)
file_out.close()