0

I want to match the size of "yellow_noise.png" to the size of the "pickedImage" from the UIImagePickerController. What should I do?

    originalImageView.image = pickedImage
    overayImageView.image = UIImage(named:"yellow_noise.png")

enter image description here

Travis
  • 29
  • 12
  • For example 1st image is larger than other, so do you want to scale up smaller one to larger, or do you want to scale down larger one to smaller, or do you want to crop larger one and keep middle portion with similar size as smaller image? – Mehul Thakkar Mar 31 '17 at 06:56
  • @MehulThakkar I want to fit a large image ("overlayImage.image") to a small image ("pickedImage") without cutting it. – Travis Mar 31 '17 at 07:05
  • So.. you want to scale down larger(overlay image) to size of smaller image.. right? – Mehul Thakkar Mar 31 '17 at 07:09
  • Go to this answer : http://stackoverflow.com/a/34599236/2160144, create extension similar to that, now call this method as, `overayImageView.scaleImage(toSize: originalImageView.size)` – Mehul Thakkar Mar 31 '17 at 07:13
  • @MehulThakkar Thank you. But It's not working... I added result of picture. – Travis Mar 31 '17 at 08:40

1 Answers1

0

Maybe you could do something like this:

let overlayImageView = UIImageView(frame: originalImageView.frame)
overlayImageView.image = UIImage(named:"yellow_noise.png")
Kawin P.
  • 187
  • 1
  • 11