Any problems? GNU nano 8.2                                                          neon_logo.py
import json
from PIL import Image, ImageFilter

# Load configuration from config.json
with open('data/config.json', 'r') as config_file:
    config = json.load(config_file)

# Get the logo path and set the background image path to test_image.jpg
logo_path = 'images/logo.png'  # Logo path remains the same                                                                                             background_path = '/root/mm/py_ad/images/test_image.jpg'  # Use test_image.jpg as background

# Load the logo image                                                                                                                                   logo = Image.open(logo_path).convert("RGBA")  # Ensure the logo is in RGBA mode
logo_size = logo.size

# Load the background image                                                                                                                             background = Image.open(background_path).convert("RGBA")
bg_width, bg_height = background.size

# Define padding for glow effect
glow_padding = 20  # Adjust as needed

# Calculate the size of the glow effect image
glow_width = logo_size[0] + glow_padding * 2  # Adding extra space for the glow
glow_height = logo_size[1] + glow_padding * 2

# Ensure the background is large enough to hold the glow effect                                                                                         if bg_width < glow_width or bg_height < glow_height:
    bg_width = max(bg_width, glow_width)
    bg_height = max(bg_height, glow_height)
    background = background.resize((bg_width, bg_height))

# Extract the alpha channel of the logo
logo_alpha = logo.split()[-1]

# Create a base image for the glow effect
glow_base = Image.new('L', (glow_width, glow_height), 0)

# Paste the logo alpha channel into the glow_base image
glow_base.paste(logo_alpha, (glow_padding, glow_padding))

# Apply a blur to the glow_base for the neon glow effect
glow = glow_base.filter(ImageFilter.GaussianBlur(radius=15))  # Adjust radius as needed

# Function to change colors (simulating neon color change)
def change_neon_color(image, color):
    # Create a color image using the specified color
    colored_image = Image.new("RGBA", image.size, color)
    # Use the glow image as the alpha channel
    colored_image.putalpha(image)
    return colored_image

# Generate a series of frames with color-shifting neon effects
colors = [
    (255, 0, 0),       # Red
    (0, 255, 0),       # Green
    (0, 0, 255),       # Blue
    (255, 255, 0),     # Yellow
    (255, 0, 255),     # Magenta
    (0, 255, 255)      # Cyan
]
frames = []  # Store frames for the GIF

for color in colors:
    # Change the color of the glow effect
    neon = change_neon_color(glow, color)

    # Start with a copy of the background image for each frame
    final_image = background.copy()

    # Calculate positions to center the glow effect on the background
    x = (bg_width - glow_width) // 2
    y = (bg_height - glow_height) // 2

    # Paste the neon glow effect onto the final image using the glow image as the mask
    final_image.paste(neon, (x, y), neon)

    # Paste the logo on top of the neon glow
    logo_position = (x + glow_padding, y + glow_padding)
    final_image.paste(logo, logo_position, logo)  # Use logo's own alpha as mask

    # Append the final image frame (converted to RGB for GIF)
    frames.append(final_image.convert("RGB"))

# Save the frames as an animated GIF
frames[0].save(
    'neon_logo_over_background.gif',
    save_all=True,
    append_images=frames[1:],
    duration=200,
    loop=0
)

print("Animated GIF saved as neon_logo_over_background.gif")