UIImage: size property
The size property is the image's width and height, in points, not pixels.
Value
Already rotated upright according to
imageOrientation.The pixel count equals
sizetimesscale.dot.png(10 pixels),dot@2x.png(20 pixels), anddot@3x.png(30 pixels) all read asizeof 10 × 10.An image view positioned with constraints, with no width or height constraints, takes this size.
Read-only; assigning to it throws
TypeError.Images are immutable and this value never changes, so there are no change notifications.
Examples
js
const dot = UIImage.imageNamed('JS/assets/dot');
if (dot) {
console.log(dot.size.width, dot.size.height);
}Result: When the project's assets/ has the set of three dot.png files, the console prints 10 10.
Corresponding iOS API
UIImage.size.