{"id":"image-vnd-valve-source-texture","mimeType":"image/vnd.valve.source.texture","name":"Valve Texture Format","shortName":"VTF","category":"3D Graphics \u0026 Gaming","extensions":[".vtf"],"description":"The image/vnd.valve.source.texture MIME type represents the Valve Texture Format (VTF), a proprietary image format developed by Valve Corporation in 2004 for the Source Engine (powering games like Half-Life 2, Portal, Team Fortress 2, and Counter-Strike: Global Offensive). Similar in concept to Microsoft's DirectDraw Surface (DDS) format, VTF is highly optimized for real-time 3D rendering. It stores image data in GPU-ready block-compressed formats (like DXT1-DXT5) and natively encapsulates mipmaps, animated texture frames, environment cubemaps, and volume textures within a single file.","seo":{"title":"image/vnd.valve.source.texture MIME Type | Developer Reference for VTF","description":"Complete reference for the image/vnd.valve.source.texture MIME type: Valve Texture Format (VTF), Source Engine textures, block compression, and modding tools.","faqs":[{"question":"What is a VTF file?","answer":"A VTF (Valve Texture Format) file is a compiled texture used by the Source Engine. It contains the raw or compressed pixel data (such as albedo, normal, or specular maps) along with mipmaps and frames used by 3D models and levels in Valve games."},{"question":"What is the difference between a VTF and a VMT file?","answer":"A VTF file contains the actual image data (the pixels), while a VMT (Valve Material Type) file is a plain text file that tells the Source Engine how to render the VTF. The VMT acts as a shader script, defining surface properties, reflections, and assigning the VTF texture to specific material channels."},{"question":"How do I edit or open a VTF file?","answer":"Standard image editors cannot open VTF files natively. Modders typically use community-developed tools like VTFEdit to view and convert them, or install dedicated VTF plugins for image editors like GIMP or Paint.NET to edit them directly."}]},"index":{"compression":["DXTC (DXT1, DXT3, DXT5)","Uncompressed (BGRA8888, RGB888, etc.)"],"browserSupport":{"score":1,"label":"None"},"commonUses":["Source Engine Game Textures","Custom Maps and Modding (Garry's Mod, CS:GO)","Animated In-Game Decals and Sprays","Environment Cubemaps (Skyboxes)"]},"technical":{"magicBytes":{"hex":"56 54 46 00","ascii":"VTF\\x00"},"container":"Valve Texture Format Header","compressionAlgorithm":["DXT1-DXT5","None"],"colorDepth":["8-bit","24-bit (RGB)","32-bit (RGBA)","16-bit Floating Point (HDR)"],"transparency":true,"animation":true,"metadata":{"exif":false,"xmp":false,"iccProfile":false},"alphaChannel":true,"progressiveLoading":false,"hdrSupport":true},"history":{"developer":"Valve Corporation","released":"2004","specification":"Valve Developer Community (VDC) Wiki"},"browserSupport":{"chrome":false,"chromeVersion":"None","firefox":false,"firefoxVersion":"None","safari":false,"safariVersion":"None","edge":false,"edgeVersion":"None","internetExplorer":false},"softwareSupport":[{"name":"VTFEdit","logo":""},{"name":"GIMP (via VTF Plugin)","logo":"gimp.svg"},{"name":"Paint.NET (via VTF Plugin)","logo":""},{"name":"Source SDK / Hammer Editor","logo":""}],"conversion":{"convertTo":["png","tga","jpeg","dds"],"convertFrom":["png","tga","jpeg","bmp"]},"developer":{"httpHeaders":[{"header":"Content-Type","value":"image/vnd.valve.source.texture"}],"htmlAccept":"image/vnd.valve.source.texture, .vtf","fileDetection":["Check the first 4 bytes for the VTF magic string 'VTF\\0' (Hex: 56 54 46 00).","The following 8 bytes dictate the format version (e.g., major version 7, minor version 1 to 5).","The header structure is heavily documented by the community and defines the width, height, frames, and exact DXTC pixel format used."]},"prosCons":{"pros":["Extremely fast loading within the Source Engine because the block-compressed data goes directly into the GPU's VRAM without CPU decompression overhead","Bundles mipmaps, volumetric slices, cubemap faces, and animation frames entirely within a single file","Openly documented by the Valve Developer Community, leading to a massive ecosystem of third-party modding tools"],"cons":["Strictly tied to the Source Engine ecosystem; entirely useless in standard web or print contexts","No native support in standard image editors without hunting down and installing specialized plugins","Block compression algorithms (DXT) are lossy and can cause visible artifacting, especially on normal maps or smooth gradients"]},"specifications":{"url":"https://developer.valvesoftware.com/wiki/Valve_Texture_Format","rfc":"","mimeAliases":["image/vtf","application/x-vtf"]},"developerSnippets":{"python":"import magic\n# Libmagic usually accurately detects the 'VTF\\0' header\nprint(magic.from_file('texture.vtf', mime=True)) # May output 'image/vnd.valve.source.texture' or generic 'application/octet-stream'","nodejs":"const fs = require('fs');\n// Manually detecting the 'VTF\\0' magic bytes\nconst buffer = Buffer.alloc(4);\nconst fd = fs.openSync('texture.vtf', 'r');\nfs.readSync(fd, buffer, 0, 4, 0);\nfs.closeSync(fd);\nconst isVTF = buffer[0] === 0x56 \u0026\u0026 buffer[1] === 0x54 \u0026\u0026 buffer[2] === 0x46 \u0026\u0026 buffer[3] === 0x00;\nconsole.log('Is VTF Texture:', isVTF);","go":"import (\n    \"bytes\"\n    \"net/http\"\n)\n// http.DetectContentType will not recognize VTF natively. Check the byte prefix directly.\n// isVTF := bytes.HasPrefix(buf, []byte{0x56, 0x54, 0x46, 0x00})","php":"$mime = mime_content_type('texture.vtf');\necho $mime; // Standard setups will often resolve this to 'application/octet-stream' without custom magic file definitions."},"relatedFormats":["dds","tga","png"]}
