79754947

Date: 2025-09-03 18:00:28
Score: 1.5
Natty:
Report link

from PIL import Image

import numpy as np

# Load the image

image = Image.open("mads2.png").convert("RGBA")

# Convert image to array

data = np.array(image)

# Define white background threshold

r, g, b, a = data[:,:,0], data[:,:,1], data[:,:,2], data[:,:,3]

white_areas = (r > 240) & (g > 240) & (b > 240)

data[white_areas] = [255, 255, 255, 0] # Set white pixels to transparent

# Create new image from modified array

transparent_image = Image.fromarray(data)

# Save the new image

transparent_image.save("connoisseur_logo_transparent.png")

Reasons:
  • Long answer (-0.5):
  • No code block (0.5):
  • Unregistered user (0.5):
  • Low reputation (1):
Posted by: user31414310