School Assignment? Project Due Tomorrow? Chat LIVE With A Programming Expert!

Welcome to Dream.In.Code
Become an Expert!

Join 306,986 Programmers for FREE! Get instant access to thousands of experts, tutorials, code snippets, and more! There are 1,963 people online right now. Registration is fast and FREE... Join Now!




Use Photoshop to Create Transparency in PNG files

 
Reply to this topicStart new topic

> Use Photoshop to Create Transparency in PNG files, Create transparency without colour keying for SDL_Image

Rating  5
stayscrisp
Group Icon



post 18 Jun, 2009 - 11:27 AM
Post #1


This tutorial will cover a basic way of creating PNG files with an alpha channel for transparency. These can be loaded into SDL_Image for transparency without colour keying. We will use photoshop for this.

PNG with transparency

I have attached a file for us to use, so download it and open it in photoshop, as you can see the background is all one colour, this is quite important to get this method to work correctly.

Most sprite sheets found online will have one colour as a background so it shouldn't be a problem.

Attached Image


For this we will use the Magic Wand Tool Attached Image

Select this tool then click on the background of the image, depending on where you clicked it should select the outline of the character plus the outline of the image itself. If it does not click somewhere else on the green background until it has selected.

Attached Image


Once you have the outline of the image and character selected click the select drop down menu or click CTRL+SHIFT+I to inverse the selection

Attached Image

Now copy the selected character by choosing copy from the drop down edit menu or pressing CTRL+C then paste the image using the drop down edit menu or pressing CTRL+V.

It will paste into a new layer, now select your background layer in the layers list, right click and delete this layer.

Attached Image

You now have a PNG with a transparency, simply choose save as and PNG file. Now when you load this image using SDL_Image it will automatically have transparency and wont have that awful colour keyed look smile.gif

Hope this helps, to get started with SDL check out my tutorials in the Game Programming Tutorials section of D.I.C.

Any questions or comments welcome.

Go to the top of the page
+Quote Post


Register to Make This Ad Go Away!


Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 


Lo-Fi Version Time is now: 11/21/09 05:35AM

Live Help!

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter Fan Us On Facebook

Tutorials

Programming

Web Development

Reference Sheets

Code Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month