Make a TF2 spray from any picture
Turn any picture into a TF2 spray right in your browser. Nothing to install and nothing gets uploaded: the image never leaves your computer. Pick a PNG, JPG, WebP, GIF or BMP, choose what to do if it isn't square, and download a .vtf file TF2 can import straight away. Transparent parts of a PNG stay transparent, so your spray can be any shape. Sprays are still images only, so an animated GIF uses 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 size. 512 × 512 works for most pictures. The preview shows what the file will actually look like after compression.
- Download the spray.
- In TF2, open Options, then the Multiplayer tab, click Import Spray… and choose the downloaded file.
- Join a server. As the game puts it: “Changes to your spraypaint image take effect when you join a server.”
Why use a spray converter
TF2 can import a picture on its own, but only within limits. Its error message spells them out: “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, accepts four file types: TGA, JPG, BMP and VTF. The game converts the first three. A VTF it leaves alone, as the code comment says: “if the file is already in the vtf format there's no need to convert it”. A converter does that step for you. It resizes the picture, picks the format and writes the VTF, so you get to choose the size and quality instead of the game.
TF2 spray size
A spray file can be 512 KB at most, or exactly 524,288 bytes: MAX_CUSTOM_FILE_SIZE in Valve's source, commented “Half a megabyte”. How many pixels fit depends on the format. BGRA8888 stores every pixel uncompressed at four bytes each. DXT1 and DXT5 are compressed: DXT1 is half a byte per pixel and (the way this maker writes it) has no transparency, while DXT5 is one byte per pixel and keeps transparency. The maker picks the format for you. Here's what you get:
| 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 lists 1020 × 1020 as the biggest spray without transparency and 724 × 724 as the biggest with it. This maker caps transparent sprays at 720 × 720, because its files include a small thumbnail, and that pushes a 724 × 724 file to 524,384 bytes, 96 over the 524,288. The wiki also says pictures that aren't square get stretched or squashed to fit, which is why the maker asks you for a shape first.
How to use sprays in TF2
Stand close to a wall or floor, look at it and press your spray key (T by default, according to the wiki). The key runs 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 checks 128 units in front of you and only sprays if it hits the map. After that you have to wait. The server setting decalfrequency controls the wait, and it starts at 10 seconds.
If your spray does not show
- Sprays might be turned off in your game. In Valve's TF2 source
cl_spraydisabledefaults to 1, and while it's on you won't see any sprays, including yours. Runcl_spraydisable 0in the console. - Decals have to be on. The same code skips all sprays when
r_decalsis 0. - Official Valve servers have sprays disabled, according to the wiki. Try a community server.
- A new spray only kicks in when you join a server, so join one after importing.
- You're too far from the wall, or the cooldown from your last spray isn't over. Move closer and try again after 10 seconds.
- The file is over 524,288 bytes. Files from this maker never are, but ones from other tools can be.
Sprays, HUDs and crosshairs
Your spray has nothing to do with your HUD and works with any of them. To change the rest of your screen, build a HUD in the TF2 HUD editor or grab one of the TF2 HUDs. For your crosshair there's the TF2 crosshair maker. To save a spray bind and cl_spraydisable 0 in an autoexec.cfg, add them as custom lines in the TF2 config maker.