---
title: "write(to:type:)"
framework: modelio
role: symbol
role_heading: Instance Method
path: "modelio/mdltexture/write(to:type:)"
---

# write(to:type:)

Exports the texture data to an image file at the specified URL, of the specified type.

## Declaration

```swift
func write(to nsurl: URL, type: CFString) -> Bool
```

## Parameters

- `nsurl`: The file URL at which to write the texture image.
- `type`: A Uniform Type Identifier declaring the image file format to use for export.

## Return Value

Return Value true if export succeeded; false otherwise.

## Discussion

Discussion For the type parameter, pass the Uniform Type Identifier for any output format supported by the Image I/O framework, such as the JPEG, TIFF, PNG, or (in macOS only) OpenEXR format. For details, see Uniform Type Identifiers Reference.

## See Also

### Exporting Textures

- [write(to:)](modelio/mdltexture/write(to:).md)
- [imageFromTexture()](modelio/mdltexture/imagefromtexture().md)
