Dear Experts,
I create a UIImage for an SFSymbol using [UIImage systemImageNamed], get its CGImage, and look at the sizes of each:
UIImageConfiguration* config =
[UIImageSymbolConfiguration configurationWithPointSize: 64
weight: UIImageSymbolWeightLight
scale: UIImageScaleMedium];
UIImage* img = [UIImage systemImageNamed: @"chevron.compact.down"
withConfiguration: config];
CGImageRef c = [img CGImage];
printf("UIImage size %f x %f, CGImage size %f x %f\n",
img.size.width, img.size.height,
CGImageGetWidth(c), CGImageGetHeight(c));
(Consider that pseudo-code, it's not an exact copy-paste.)
Results:
UIImage is 70.3333 x 25.6667 and CGImage is 163 x 43.
So the aspect ratios (W/H) are 2.74 and 3.79 respectively. That can't be right!
I don't expect the UIImage and the CGImage dimensions to be the same, because of the UIImage's scale (which is 3 in this case). But that should be the same for both dimensions.
The effect is most pronounced with symbols that have an aspect ratio far from 1, e.g. recordingtape, ellipsis, and this chevron.compact.down.
I believe that the CGImage aspect ratios are the correct ones.
What is going on here?