<!--
{
  "availability" : [
    "iOS: 11.0.0 -",
    "iPadOS: 11.0.0 -",
    "macCatalyst: 14.0.0 -",
    "macOS: 11.0.0 -",
    "tvOS: 14.5.0 -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Metal",
  "identifier" : "/documentation/Metal/MTLComputeCommandEncoder/setImageblockWidth(_:height:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "Metal"
    ],
    "preciseIdentifier" : "c:objc(pl)MTLComputeCommandEncoder(im)setImageblockWidth:height:"
  },
  "title" : "setImageblockWidth(_:height:)"
}
-->

# setImageblockWidth(_:height:)

Sets the size, in pixels, of imageblock data in tile memory.

```
func setImageblockWidth(_ width: Int, height: Int)
```

## Parameters

`width`

The width of the imageblock, in pixels.

`height`

The height of the imageblock, in pixels.

## Discussion> Important:
> The sum of all threadgroup memory allocations (whether made using this method or directly in the shader) can’t exceed the device limits for threadgroup memory. Check threadgroup memory limits with the ``doc://com.apple.metal/documentation/Metal/MTLComputePipelineState/staticThreadgroupMemoryLength`` property.

Both imageblocks and threadgroup memory share the available space you can reserve in tile memory, so the sum of these allocations can’t exceed the maximum total tile memory limit. To find the amount of memory used by an imageblock, call [`imageblockMemoryLength(forDimensions:)`](/documentation/Metal/MTLComputePipelineState/imageblockMemoryLength(forDimensions:)). Kernels accessing an imageblock argument from threadgroup memory have the `[[threadgroup_imageblock]]` attribute.

To learn more about using imageblocks, see the following sections in the [Metal Shading Language Specification](https://developer.apple.com/metal/metal-shading-language-specification.pdf#//apple_ref/doc/uid/TP40014364-CH4-SW5):

- For information on the `threadgroup_imageblock` address space, see Section 4.5.
- For information on the `imageblock` type, see Section 2.11.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)