> For the complete documentation index, see [llms.txt](https://help.vectary.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.vectary.com/api/model-api/api-reference/maptextures.md).

# mapTextures

#### mapTextures

Overlays a texture on top of another. Useful for print-on-demand applications.

#### Signature

```typescript
mapTextures(
  baseTextureId: string, 
  overlayTextureId: string, 
  options?: MapOptions
): Promise<void>
```

#### Parameters

| Name               | Type         | Required | Description               |
| ------------------ | ------------ | -------- | ------------------------- |
| `baseTextureId`    | `string`     | Yes      | ID of the base texture    |
| `overlayTextureId` | `string`     | Yes      | ID of the overlay texture |
| `options`          | `MapOptions` | No       | Positioning options       |

```typescript
type MapOptions = {
 top?: number;    // Offset from top in pixels
 left?: number;   // Offset from left in pixels
 width?: number;  // Width in pixels
 height?: number; // Height in pixels
};
```

#### Returns

`Promise<void>`

#### Usage

```javascript
// Get base texture from material
const material = await api.getActiveMaterial("T-Shirt");
const baseId = material.baseColor.textureConfig.id;

// Add user's custom image
const overlayId = await api.addTexture(userFile);

// Map overlay onto base (full size)
await api.mapTextures(baseId, overlayId);

// Map with positioning
await api.mapTextures(baseId, overlayId, {
  top: 20,
  left: 30,
  width: 40
});
```

#### Notes

* Values are pixels relative to the base texture dimensions. For example, if the base texture is 512×512, passing `width: 512` will cover the full width.
* `width` has preference over `height` if both specified
* `top` and `left` default to 0
* The overlay is composited onto the base texture permanently
* Ideal for product customization (t-shirts, mugs, phone cases)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://help.vectary.com/api/model-api/api-reference/maptextures.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
