1. For starters, you'll need to get an image of the weapon. Simplest way to create one is by loading up your weapon's .glm in ModView, moving the weapon to your liking and then copy/paste (Ctrl+C/Ctrl+V) the render into Photoshop.
2. In PS, first remove the background (if you're not sure how to, take a look here)
3. Press Ctrl+Alt+C (or go to Image -> Canvas Size) and resize your canvas to be a square (Same height as width).
4. Now position your weapon by moving it to the middle and a few notches to the top (this will make sure the weapon's name text won't be too close to the icon). If need be, also scale the render of your weapon down to make it look somewhat like this:
W icon example
5. Resize your image (Ctrl+Alt+I) to 128x128.

For the regular icon:

6. Open up the Blending Options (double-click the layer in the side panel or right-click on it's name there an pick Blending Options in the menu) and select Outer Glow. Change the color to 2f61ac and give it a size of 12.
7. Press Shift+Ctrl+Alt+S to save it for web and save it as a .png. Name it "w_icon_yourweaponsname.png".

For the _na icon:

Simply go back in the history in PS to step 6 for the regular icon.

8. Open up the Blending Options again and set the size of the Outer Glow to 2.
9. Press Shift+Ctrl+Alt+S to save it for web and save it as a .png. Name it "w_icon_yourweaponsname_na.png".

In general, for guns and grenades you'll always need both icons as one is used when the weapon has ammo left, and the other shows when it doesn't. Melee weapons only need the regular icon.

Also make sure to save all your weapon icons in the /gfx/hud/ folder in your .pk3. This way you'll help establish a standard and make sure everyone can find the icon quickly if need be.