本文介绍了如何使用pygame.image加载PNG文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 29岁程序员,3月因学历无情被辞! 我只是想用这段代码加载带有pygame的图像: import pygame myimage = pygame.image.load(bla.png) 我收到错误:请注意,当我调用 pygame.image.get_extended()时,它返回0. 如何修复它并获取其他格式? 谢谢解决方案 图像的Pygame文档明确说明 所以,我想你应该运行 pygame.image.get_extended()#返回bool 检查是否可以加载其他扩展程序的图像。如果没有,我想你需要安装Python成像库才能获得Pygame支持的扩展文件格式。 或者,你可以随时将图像转换为BMP避免麻烦。 I'm simply trying to load an image with pygame with that piece of code :import pygamemyimage = pygame.image.load("bla.png")And I get the error :Note that when I call pygame.image.get_extended() it returns 0.How can I fix that and get the other formats ?Thanks 解决方案 The Pygame documentation for images explicitly saysSo, I suppose you should runpygame.image.get_extended() # returns a boolto check if you can load images of other extensions. If not, I suppose you will need Python imaging libraries to be installed to get extended file formats to be supported by Pygame.OR, you could always convert the images to BMP to avoid the hassle. 这篇关于如何使用pygame.image加载PNG文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 上岸,阿里云!
08-31 09:48
查看更多