-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Description
from PIL import Image, ImageDraw, ImageFont # Load your image image_path = "IMG_0574.png" # Ensure this file is in the same directory img = Image.open(image_path).convert("RGBA") # Drawing context draw = ImageDraw.Draw(img) # Text values uc_text = "50000" gcoin_text = "148" # Coordinates (adjust if needed) uc_coords = (img.width - 215, 30) # UC position gcoin_coords = (img.width - 305, 30) # G-Coin position # Use default font font = ImageFont.load_default() # Outline text drawing function def draw_text_with_outline(draw, position, text, font, text_color, outline_color, outline_width=2): x, y = position for dx in range(-outline_width, outline_width + 1): for dy in range(-outline_width, outline_width + 1): draw.text((x + dx, y + dy), text, font=font, fill=outline_color) draw.text(position, text, font=font, fill=text_color) # Draw the UC and G-Coin text with outline draw_text_with_outline(draw, uc_coords, uc_text, font, (255, 255, 255), (0, 0, 0)) draw_text_with_outline(draw, gcoin_coords, gcoin_text, font, (255, 255, 255), (0, 0, 0)) # Save the edited image img.save("edited_pubg.png") print("Image saved as edited_pubg.png"