I have a function that takes a UIImage and a colour and uses it to return a UIImage in just that colour.
As part of the function the UIImage is converted to a CGImage bu
It's because UIImage has a scale
property. This mediates between pixels and points. So, for example, a UIImage created from a 180x180 pixel image, but with a scale
of 3, is automatically treated as having size 60x60 points. It will report its size as 60x60, and will also look good on a 3x resolution screen where 3 pixels correspond to 1 point. And, as you rightly guess, the @3x
suffix, or the corresponding location in the asset catalog, tells the system to give the UIImage a scale
of 3 as it forms it.
But a CGImage does not have such a property; it's just a bitmap, the actual pixels of the image. So a CGImage formed from a UIImage created from 180x180 pixel image is 180x180 points as well.