Make a TF2 spray from any picture
This TF2 spray maker turns a picture into a spray file in your browser. There is nothing to install and nothing is uploaded: the picture stays on your computer. Choose a PNG, JPG, WebP, GIF or BMP file, say what happens to it if it is not square, and download one .vtf file that TF2 imports as it is. The transparent parts of a PNG stay transparent, so the spray can have any outline. The maker makes still sprays: an animated GIF gives its first frame.
How to make a TF2 spray
- Choose a picture at the top of this page, drop one on the preview, or paste one.
- Pick a shape and a size. 512 × 512 suits most pictures. The preview shows the picture as the file holds it, after compression.
- Download the spray.
- In TF2, open Options, then the Multiplayer tab, click Import Spray… and choose the downloaded file.
- Join a server. The game says so itself: “Changes to your spraypaint image take effect when you join a server.”
Why use a spray converter
TF2 can import a picture without one, within limits. Its own error message names them: “Valid height and width values in pixels are 256, 128, 64, 32, 16, 8, 4, 2, and 1.” The function that writes the spray file in Valve's published source, ImgUtl_ConvertToVTFAndDumpVMT, takes four kinds of file: TGA, JPG, BMP and VTF. The first three are converted by the game. A VTF file is not: the comment in the code reads “if the file is already in the vtf format there's no need to convert it”. A spray converter does that work before the game sees the picture. It resizes the picture, picks the format and writes the VTF file, so the size and the quality are your choice.
TF2 spray size
A spray file can be 512 KB at most. The exact number is 524,288 bytes: MAX_CUSTOM_FILE_SIZE in Valve's source, with the comment “Half a megabyte”. How many pixels fit depends on the format of the file. BGRA8888 keeps every pixel as it is, at four bytes a pixel. DXT1 and DXT5 are compressed: DXT1 takes half a byte a pixel and, the way this maker writes it, has no transparency. DXT5 takes one byte a pixel and has it. The maker picks the format for you. These are its files:
| Size in pixels | No transparency | With transparency |
|---|---|---|
| 256 × 256 | BGRA8888, 262,352 bytes | BGRA8888, 262,352 bytes |
| 512 × 512 | DXT1, 131,280 bytes | DXT5, 262,352 bytes |
| 720 × 720 | DXT1, 259,408 bytes | DXT5, 518,608 bytes |
| 1020 × 1020 | DXT1, 520,408 bytes | Does not fit |
The TF2 wiki gives 1020 × 1020 as the largest spray with no transparency and 724 × 724 as the largest with it. This maker stops at 720 × 720 for a picture with transparency. Its files start with a small thumbnail, and with it a 724 × 724 file comes to 524,384 bytes: 96 over the 524,288. The wiki also says that a picture that is not square is stretched or squashed into one, which is why the maker asks for a shape first.
How to use sprays in TF2
Stand close to a wall or a floor, look at it and press the spray key. The wiki gives T as the default. The command behind the key is impulse 201, so bind f "impulse 201" in the console moves it to F. In Valve's server code that impulse is “paint decal”: the game looks 128 units ahead of your eyes and paints only if the map is there. Then there is a wait before the next one. The server setting decalfrequency sets it, and it starts at 10 seconds.
If your spray does not show
- Sprays may be switched off in your game. In Valve's TF2 source the setting
cl_spraydisablestarts at 1, and while it is on the game draws no spray at all, yours included. Runcl_spraydisable 0in the console. - Decals must be on. The same code skips every spray when
r_decalsis 0. - The wiki says that official Valve servers have sprays disabled. Try a community server.
- A new spray takes effect when you join a server, so join one after the import.
- You are too far from the wall, or the wait since your last spray is not over. Move closer and try again after 10 seconds.
- The file is over 524,288 bytes. No file from this maker is, but one from another tool can be.
Sprays, HUDs and crosshairs
A spray is separate from your HUD and works with any of them. To change the rest of the screen, make a HUD in the TF2 HUD builder or pick one of the TF2 HUDs. For the crosshair there is a TF2 crosshair maker. To keep a spray bind and cl_spraydisable 0 in an autoexec.cfg, add them as your own lines in the TF2 config maker.