Pygame加载原始图像的故障版本

2024-10-03 23:28:35 发布

您现在位置:Python中文网/ 问答频道 /正文

你好,我们的社区!!你知道吗

我在这个社区做了很长时间的浏览者,但还是第一次做海报。 我发帖只是因为我也很绝望。当我在pygame中导入图像时,某些图像会变得一团糟,无法修复。我用内置的pygame.image.load文件(文件名)奇怪的灰度图像是JPG,奇怪的像素化图像是PNG。我不会以任何有意义的方式变换图片,除非我试图修复bug。我将在下面提供相关代码。非常感谢你的帮助,这意味着很多

class Alarm(MySprite):  

def __init__(self,image,x,y,radius,boundaries = None):
    MySprite.__init__(self,image,x,y)

    self.radius = radius

-------------------------你知道吗

def draw(self,screen):
    MySprite.draw(self,screen)


self.fireAlarmImage = pygame.image.load("fireAlarm.png")

if self.editing:
            self.background = Background(
                            "editing_background%d.jpg"%(self.level), True)

def set_background(self, picture = None):
    if picture:
        self.background = pygame.image.load(picture).convert_alpha()

Weird Perspective/Greyscale/ParticiallyDuplicated/Shifted Pygame Version

Original Image


Tags: 图像imageselfnoneinitdefloadscreen