0

I used a graphic routine to draw and image on grabbed it as an image as shown below.

 for event in pygame.event.get(): if event.type == UPDATE: y += 1 get_image = screen.subsurface(60, 62, 82, 70) get_image.set_colorkey( (0,0, 0), RLEACCEL ) if imageno <= 9: st = "0" + str(imageno) else: st = str(imageno) pygame.image.save(get_image, "graphicstest\\" + "mojo" + st + ".png") imageno += 1 

But when I load an image with

img=pygame.image.load(path).convert.alpha() 

and blit to screen the black area of the image shows. It is NOT transparent. Any suggestions?

2 Answers 2

1

Change your convert_alpha() to just convert(), then the colorkey should work. If it doesn't, take away the RLEACCEL.

I just came across this same issue last night. I was using convert_alpha() on my images along with colorkey, and my images still had their undesired background. Changing to just convert() solved it.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you for your answer which I accept. I too figured it out just now. :)
0

i solved the problem. I removed the line get_image.set_colorkey( (0,0, 0), RLEACCEL ) from the code block where I grab the image.

Then I loaded it with img=pygame.image.load(path. Did img.set_colorkey((0, 0, 0)) pygame.Surface.convert_alpha(img) This worked perfectly.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.