> 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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
