0

I'm trying to load this image without its shadow

I've tried getting the color key by printing the color where my mouse is and and then setting the images color key to that color. I also tried adding convert_alpha() when loading the image but it still didn't work. Am I just getting the color wrong or is there another way of removing colors other than setting the color key. I tried searching google but it only shows setting the color key.

My current code

import pygame, sys


pygame.init()
display = pygame.display.set_mode((1280, 720))
clock = pygame.time.Clock()


while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit()
            sys.exit()
        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_ESCAPE:

                pygame.quit()
                sys.exit()
                
            if event.key == pygame.K_RETURN:
                print(display.get_at(pygame.mouse.get_pos()))

    display.fill('white')

    image = pygame.image.load('mystic_woods_free_v0.2/sprites/characters/player.png')
    image = pygame.transform.scale(image, (image.get_rect().width * 6, image.get_rect().height * 6))
    image.set_colorkey((138, 141, 151))

    display.blit(image, (0, 0))

    pygame.display.update()
    clock.tick(60)

1 Answers1

0

I found out the true color of the shadow by using
pygame.image.load(...).convert()
and then using that color as the colorkey (which works without .covert() )