0

I have a simple UIImage that I want as a map annotation. The original image is 300x500 but I want it down to 20*26.

var img = UIImage(named: "annotation")
img.size.width = 20 

This gives me a "Cannot assign to property: 'size' is a get-only property" error.

How can I resize a UIImage without embedding it in any views? (Map annotations are strictly UIImages)

Thank you.

  • Possible duplicate of: [The simplest way to resize an UIImage?](https://stackoverflow.com/questions/2658738/the-simplest-way-to-resize-an-uiimage) – TylerP Mar 29 '20 at 21:59
  • https://stackoverflow.com/questions/24709244/how-do-set-a-width-and-height-of-an-image-in-swift I think you will find your answer there :) – Lucky Mar 29 '20 at 22:42
  • Google is your friend as a developer — https://nshipster.com/image-resizing/ – Michael Wells Mar 30 '20 at 01:13

0 Answers0