A list or range of sizes that augment an image constraint's default size.


class MLImageSizeConstraint : NSObject


You use an MLImageSizeConstraint to express what image sizes of an image feature a model will accept as input or produce as output.

Use type to determine which properties describe what image sizes the model's image feature expects as input or produces as output.

If type is:

Figure 1

An example of an image size that meets a range-based constraint

Graph diagram showing the constraint's rectangle defined by the width and height ranges of the constraint, and a blue rectangle, representing a valid image size. The diagram's X-axis spans from 0 to 250 pixels and the Y-axis spans from 0 to 200 pixels. The constraint rectangle, which has a dashed outline, has a width that spans from 50 to 250 pixels, and a height that spans from 100 to 200 pixels. The sample image size has its lower-left corner at the graph's origin and its upper-right corner is within the bounds of the constraint rectangle, at 150 pixels wide by 180 pixels high.


Determining Relevant Constraints

var type: MLImageSizeConstraintType

Indicator of which properties to inspect for this image size constraint.

enum MLImageSizeConstraintType

The modes that determine how the model defines a feature's image size constraint.

Accessing the Image Size Ranges

var pixelsWideRange: NSRange

The range of widths a model's image feature accepts as input or produces as output.

var pixelsHighRange: NSRange

The range of heights a model's image feature accepts as input or produces as output.

Accessing the Enumerated Image Sizes

var enumeratedImageSizes: [MLImageSize]

An array of image sizes a model's image feature accepts as input or produces as output.

class MLImageSize

The width and height of an image feature size.


Inherits From

See Also

Inspecting Acceptable Sizes

var sizeConstraint: MLImageSizeConstraint

Additional sizes this image feature supports.