---
title: "encode(commandBuffer:sourceImage:destinationMatrix:)"
framework: metalperformanceshaders
role: symbol
role_heading: Instance Method
path: "metalperformanceshaders/mpsimagecopytomatrix/encode(commandbuffer:sourceimage:destinationmatrix:)"
---

# encode(commandBuffer:sourceImage:destinationMatrix:)

## Declaration

```swift
func encode(commandBuffer: any MTLCommandBuffer, sourceImage: MPSImage, destinationMatrix: MPSMatrix)
```

## See Also

### Instance Methods

- [encodeBatch(commandBuffer:sourceImages:destinationMatrix:)](metalperformanceshaders/mpsimagecopytomatrix/encodebatch(commandbuffer:sourceimages:destinationmatrix:).md)
