I'm resizing an UIImage, after the resizing if I print the size:
print(myImage.size)
I get the output:
(295.5, 350.0)
After saving the image I check the resolution and I get:
555 × 700 pixels
Isn't the UIImage.size the resolution of the image?
To get pixel resolution of your image you could use next snippet:
let image: UIImage = ...
let size = CGSize(width: image.size.width * image.scale, height: image.size.height * image.scale)
It takes into account image's scale value.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With