oriol filter 5c753ae8f5 test
2022-11-26 14:55:55 +00:00

71 lines
1.5 KiB
Python
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import PIL.Image
from colorama import Fore, Back, Style
from colored import fg, bg, attr
import pyperclip
import numpy as np
import PIL
img = './b.png'
scale = 1
windows: bool = True
class RGB:
def __init__(self):
pass
red: int = 0
green: int = 255
blue: int = 255
def __hex__(self):
h = f"{'%02x' % self.red}{'%02x' % self.green}{'%02x' % self.blue}".upper()
print(h)
return h
def rr(char: str, color: RGB):
return f"\033[38;2;{color.red};{color.green};{color.red}m{char} \033[38;2;255;255;255m"
if windows:
from colorama import just_fix_windows_console
just_fix_windows_console()
#
# text=f'{Fore.RED}TEst{Fore.RESET}'
# pyperclip.copy(text)
# text=f"redred"
# text2=f"{Fore.RED}red{Fore.RESET}red"
# text3=f"{Fore.RED}red{Fore.RESET}red".encode().replace(b'\x1b[',b'\x1b[2;').decode()
# print(text)
# print(text2)
# print(text3)
# print(text2.encode())
# print(text.encode())
# print(text3.encode())
# print(Back.GREEN + 'and with a green background')
# print(Style.DIM + 'and in dim text')
# print(Style.RESET_ALL)
# print('back to normal now')
img_data = PIL.Image.open(img)
print(img_data.info)
img_arr = np.array(img_data)
#
for line in img_arr:
print(line)
r = RGB()
# print(r.__hex__())
# print(img_arr)
color = fg('#C0C0C0') + bg('#00005f')
res = attr('reset')
t = color + "Hello World !!!" + res
print(t)
print(t.encode())
print(f'{fg(1)} Hello World !!! {attr(0)}')
print(bg(30))