View Full Version : Image Sprites???

09-29-2008, 11:08 PM
I have a VERY important question for anybody who knows anything about images or sprites.

To the point:

You know how sometimes when you want to make an image that will have the background blend in with the webpage around it? Yeah. That's my problem. I want to make an image that will have it's background blend in with the webpage - also: I really also wish to make images of which background will blend in with ANYTHING!! I know that this is possible, but I don't know how to do it... I have heard that you change the background color to like "light green" or whatever. I am not sure. I just want to have the background blend in - specifically with a C++ game I made. Would you have to do something with a paint program?

Please help! Help is URGENT!!


09-29-2008, 11:28 PM
Use a PNG with transparency! Go from your solid color/image to transparent. That way, it doesn't matter what the background is.

Is that what you're going for?

09-30-2008, 05:56 AM
By 'light green' you were probably thinking of GIF transparency. In GIF, one assigns a certain colour out of the 256-colour palette to be transparent, and then every pixel of that colour is rendered as being completely transparent. PNG doesn't do this: instead, it has a separate 'alpha' field for each pixel, along with the red, green, and blue fields, whose value denotes the level of opacity the pixel should have.

Of course, it's also possible to implement GIF-like transparency in your own application, simply by not rendering any pixels of your chosen colour. Using the built-in GIF transparency, however, will allow the sprite designers to worry about choosing an appropriate transparent colour for which they didn't have another use.

10-01-2008, 12:33 AM
@ Medyman

Could you explain how to do that with a paint program? You know, just explain the process of making the background transparent (namely with Paint.NET). Thanks for your post!

@ Twey

Yeah. GIF transparency. Save the fact I make PNG and BMP images... Could you explain how I would change the level of opacity of a pixel, or as you say, "alpha field for each pixel".

All I need to know is how to make my PNG or BMP pixels transparent. Then I'm good to go. You see, I am taking on the mission of making a game similar to The Legend of Zelda game for the NES in JavaScript. Thanks for your post!

Thanks, you guys, for giving me advice.


10-01-2008, 04:45 AM
I don't know about Paint.NET, but with a good image editor like the GIMP, you can set the alpha of colours in the colour selector, or do a layer-wide 'colour to alpha' operation. It's probably similar in PaintShop. BMP does not support transparency (and you should never use BMP for anything — it's virtually feature-free and uncompressed, so it has a huge filesize, whilst not storing anything that PNG doesn't).

10-01-2008, 09:29 PM
Alright. I just found out how to do it with Paint.NET. Thank you all!!