Prepare your 512x512 PNG
Use your favorite image editor to downscale and crop your image properly. Your final result must be 512x512 pixels. Save it as a PNG with transparency (if applicable).
Note: You should leave at least a 1px transparent border for images with transparency. In other words, your output image is still 512x512, but your maximum drawing region would be 510x510. Failure to do so may cause your spray to have a faint white border or horizontal line at the top when sprayed in-game. This is due to a technicality with how DirectX handles textures with alpha channels.
Convert your PNG to TGA
Download VTFEdit 1.2.5
1. Click and download "Archive (743 KB)"
2. Create a folder in your documents folder called "vtfedit125-11"
3. Extract the contents (7 files) of your downloaded ZIP file to your vtfedit125-11 folder.
Use VTFEdit to set up and create your VTF and VMT files
1. Open VTFEdit.exe
2. Click File -> Import and open your TGA.
3. Leave these default options alone, but make sure resize is unchecked. Click OK.
4. Make sure Mask is enabled (View -> Mask) to enable transparency.
5. Three flags need to be checked: Eight Bit Alpha, No Mipmap, and No Level Of Detail.
6. Save as spray.vtf (File -> Save As). Save your VMT file as well (Tools -> Create VMT File -> Create).
Paste your VTF and VMT into Counter-Strike's spray directory
Copy spray.vtf file into:
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Source\cstrike\materials\vgui\logos
Copy spray.vmt file into:
C:\Program Files (x86)\Steam\steamapps\common\Counter-Strike Source\cstrike\materials\vgui\logos\ui
Before you place those files, delete any existing VTF or VMT files in both folders.
You must set your spray.vtf file as read-only. (Right-click -> Properties -> check Read-only). Don't skip this step or your spray won't change.
Note: the consequence of setting this file as read-only is that you will not be able to use the inferior in-game spray image importer to change your spray.
Launch CSS and test your spray.