Skip to content

Add Mast light ico#7

Open
qux-bbb wants to merge 1 commit into
jonaskohl:mainfrom
qux-bbb:main
Open

Add Mast light ico#7
qux-bbb wants to merge 1 commit into
jonaskohl:mainfrom
qux-bbb:main

Conversation

@qux-bbb
Copy link
Copy Markdown

@qux-bbb qux-bbb commented Sep 21, 2023

This script can convert Mast dark to Mast light:

import os
from PIL import Image


def invert_high_red_pixels(image_path, output_path):
    img = Image.open(image_path)
    img = img.convert("RGBA")
    pixels = img.load()

    width, height = img.size

    for x in range(width):
        for y in range(height):
            r, g, b, a = img.getpixel((x, y))
            if r > 125:
                pixels[x, y] = (255 - r, 255 - g, 255 - b, a)

    img.save(output_path)


source_folder = "Mast_Dark"
destination_folder = "Mast_light"

if not os.path.exists(destination_folder):
    os.makedirs(destination_folder)

for filename in os.listdir(source_folder):
    if filename.endswith(".ico"):
        source_path = os.path.join(source_folder, filename)
        dest_path = os.path.join(destination_folder, filename)

        invert_high_red_pixels(source_path, dest_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant