-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathimagetorgb.py
More file actions
21 lines (21 loc) · 755 Bytes
/
imagetorgb.py
File metadata and controls
21 lines (21 loc) · 755 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
from PIL import Image
import pyperclip
image = Image.open(input("Paste the full file name here: "))
rgbimage = image.convert("RGB")
output = ""
print(image.size)
i = 1
for y in range(image.size[1]):
for x in range(image.size[0]):
colorset = rgbimage.getpixel((x,y))
colorset = [str(a) for a in colorset]
for index, a in enumerate(colorset):
if len(a) == 2:
colorset[index] = "0"+ colorset[index]
elif len(a) == 1:
colorset[index] = "00"+ colorset[index]
colorstr = str(colorset).replace(',', '').replace(' ', '').replace("[","").replace("]","").replace("'", "")
output = output + colorstr
i +=1
pyperclip.copy(output)
spam = pyperclip.paste()