---
title: "init(targetWidth:targetHeight:)"
framework: createmlcomponents
role: symbol
role_heading: Initializer
path: "createmlcomponents/randomimagecropper/init(targetwidth:targetheight:)"
---

# init(targetWidth:targetHeight:)

Creates an augmentation that crops an input image at a random location to the specified target width and height.

## Declaration

```swift
init(targetWidth: Double, targetHeight: Double)
```

## Parameters

- `targetWidth`: The target width of the cropping rectangle. Must be positive.
- `targetHeight`: The target height of the cropping rectangle. Must be positive.

## See Also

### Creating an image cropper

- [init(scale:aspectRatio:)](createmlcomponents/randomimagecropper/init(scale:aspectratio:).md)
- [init(targetSize:)](createmlcomponents/randomimagecropper/init(targetsize:).md)
