# Texture Optimization

Hand-made clothing packs are usually bloated and full of textures the game doesn't like — odd sizes, no mipmaps, wrong compression. The Cloth Tool fixes all of that in one action.

## What "Optimize" does

Right-click a texture (or a whole item) and choose **Optimize**. The pipeline:

1. **Decode** the source texture to raw pixels.
2. **Resize to power-of-two** — the nearest valid size (256, 512, 1024, 2048…). Ties round down.
3. **Recompress** to the correct **BCn** format for the map type.
4. **Generate mipmaps**.
5. Write the result as a managed `.ytd` inside `<project>/assets/`.

The status line shows the **before → after** size so you can see what you saved.

## Auto-format selection

The tool picks a compression format from the texture's content and name:

| Texture                       | Format         | Why                                |
| ----------------------------- | -------------- | ---------------------------------- |
| Diffuse, **no alpha**         | **BC1** (DXT1) | Smallest; alpha not needed.        |
| Diffuse, **has alpha**        | **BC3** (DXT5) | Keeps the alpha channel.           |
| Normal map (`_n` / `_normal`) | **BC5**        | Two-channel, high-quality normals. |
| High-detail / override        | **BC7**        | Best quality where size allows.    |

You can override the format per texture if you know better.

## The managed assets model

* Imports are **copied** into `<project>/assets/`.
* Optimize rewrites the **managed copy** — your original files are **never** modified.
* This is what makes projects safe to move, rename and share.

:::hint{type="success"}
**Rule of thumb:** optimize everything before you build. It's the single biggest win for pack size and in-game stability, and it clears most Cloth Doctor warnings automatically.
:::

## Exporting

Need a texture out of the project? Right-click → **Export** to DDS, PNG or XML — useful for edits in an external image editor or for building store renders.

## Related pages

- [3D Preview](/cloth-tool/about-the-tool/3d-preview) — The centre panel renders your garment on an actual mpmfreemode01 / mpffreemode01 ped, with your real .ytd textures applied.
- [Building](/cloth-tool/about-the-tool/building) — When your project is ready, hit Build and choose the FiveM target.
- [Importing](/cloth-tool/about-the-tool/importing) — Select an item and click Import .ydd / .ytd (or right‑click an item → import).
- [Interface](/cloth-tool/about-the-tool/interface) — The main window is split into three panels.
- [Items and Textures](/cloth-tool/about-the-tool/items-and-textures) — An item is one garment or prop.
- [Team Collaboration](/cloth-tool/about-the-tool/team-collaboration) — The Cloth Tool has Git‑based collaboration built in, so a team can work on the same pack without emailing folders around — and you get a full, restorable history of every change.
- [About the Tool](/cloth-tool/about-the-tool) — back to the section overview
