Reputation: 2468
I need explications about this code
// Resizing Image
let size = CGSizeMake(rect.size.width, rect.size.height)
print (size)
UIGraphicsBeginImageContextWithOptions(size, false, 1)
_image.drawInRect(rect)
let resizedImage = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
print(resizedImage.size)
This my console :
(18.5, 18.5)
(19.0, 19.0)
Can you explain why my resizing does not work correctly. Why my resizedImage is not 18.5 x 18.5 ?
Upvotes: 1
Views: 82
Reputation: 4104
You cannot create an image that has a size of 18.5 pixels. There is no meaning for half a pixel. So the system rounds up your values.
Upvotes: 4