File size: 653 Bytes
4441340
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
from PIL import Image, ImageOps
import numpy as np

# Open the logo
img = Image.open('logo.png')

# Convert to RGBA if not already
img = img.convert('RGBA')

# Get the data
data = np.array(img)

# Separate RGB and Alpha channels
rgb = data[:, :, :3]
alpha = data[:, :, 3]

# Invert RGB channels (255 - value)
inverted_rgb = 255 - rgb

# Combine inverted RGB with original alpha
inverted_data = np.dstack((inverted_rgb, alpha))

# Create new image
inverted_img = Image.fromarray(inverted_data.astype('uint8'), 'RGBA')

# Save the inverted logo
inverted_img.save('logo-inverted.png')

print("Logo colors inverted successfully! Saved as logo-inverted.png")