I have created a TF2 backpack icon template PSD file for creating backpack icons, it has rulers and a few top layers to delimit the zone of the icon which should be black.
Open up the PSD in photoshop:
You can press CTRL + H
to show/hide the blue rulers, these are simply there to delimit the area in which your item's screenshot should fit, in the center.
Loading and placing the icon
Backpack icons contain the icon color image in the RGB channel, the transparency for the icon is defined by the Alpha channel, we need to create it.
Load the two screenshots in Photoshop and add them in the template PSD layer's:
Make sure both layers are aligned and that they are betwen the background layer and the "bounds" group.
Select both layers of the white and black background screenshots.
Use the move tool (V) and the transform tool (CTRL + T) to move and scale the icon so it fits properly in the center without going out of the bounds.
Creating the transparency mask
Once you have placed your icon properly we can create the alpha, at this point you should no longer move or scale any layer!Duplicate the layer of the screenshot with black background and disable its visibility, we will need it later.
In order to create the alpha mask, select one of the screenshots layer, the one on top
and set its layer blending mode to "difference".
You should get a black and white image:
Select both layers (white/black background screenshots).
Merge the two selected layers: CTRL + E
Invert the image colors: CTRL + I
(the item should be in white, in alpha black = transparent)
And here is our alpha mask! you should get this:
Now we just need to fill the empty space around it.
Create a layer below and fill it with black, select the mask and the black layer and merge them.There's a catch here!
The TF2 item importer does not like left over non-black pixels, so we need to do a little cleanup.
You might notice (in the previous image) that there's some brighter pixels on the edges of the mask layer even after we merge it with a black layer.
In order to fix this, use a black brush with the color set to black and paint over to get rid of these non black edges, you should get this:
That's it, we have our Alpha mask for transparency! =)
Now we need to copy this to the Alpha channel.
While having the mask layer selected, press CTRL + A
then CTRL + C
Next to the "Layers" tab select the "Channels" tab.
Select the "Alpha" layer and hit CTRL + V
to paste the alpha mask in the alpha channel.
Select the RGB Channel
Return to the Layers
Select the hidden layer with the screenshot of the item in color with a black background and make it visible.
Finally we just need to flatten the image
In the menu Layer > Flatten Image
.File > Save as...Make sure you have the "Alpha Channels" checked:
Next you will get a popup, make sure you have these settings:
Your backpack icon is saved in TGA, ready to be used with the TF2 importer.