title: Why is jpegData not saving my resized image? UPDATED
body: <p>I am taking a photo from the camera or the Photo gallery and saving it in my application. I don't need such a large image so I am using an extension to reduce it. Then I am saving it to the application space. But the size reduction is not saved.</p>
  
  <p>I have tried various permutations on size change, delete and save.</p>
  
  <pre><code>            let path = "/var/mobile/Containers/Data/Application/0595DE63-AE43-4DCF-9BD0-FB552844ECF5/Documents/tour15/H25.jpg"
              print("A",hotspotImage.image!.size)
              hotspotImage.image = hotspotImage.image!.resizeImage(2048, opaque: true)
              print("B",hotspotImage.image!.size)
              let fileManager  = FileManager.default
              try! fileManager.removeItem(atPath: path)
              try! hotspotImage.image!.jpegData(compressionQuality: 0.8)!.write(to: URL(fileURLWithPath: path), options: [.atomic])
              print("C",hotspotImage.image!.size)
              let  imageTest = UIImage(contentsOfFile: path)
              print("D",imageTest!.size)
  </code></pre>
  
  <p>The results are ...</p>
  
  <p>A (4032.0, 3024.0)</p>
  
  <p>B (2048.0, 1536.0)</p>
  
  <p>C (2048.0, 1536.0)</p>
  
  <p>D (4096.0, 3072.0)</p>
  
  <p>When I retrieve the "updated" image it has the original size. You cannot see this but the image has definitely been replaced.</p>
  
  <p>Obviously I am missing something fundamental - please put me out of my misery.</p>
  
  <p>Apologies to those kind people who responded previously - but I have now discovered some extra and important information. The example size was fooling us all. When I changed the reduced size to 200 (and not exactly half the original size) I get the following results:</p>
  
  <p>A (4032 3024)</p>
  
  <p>B (200 150)</p>
  
  <p>C (200 150)</p>
  
  <p>D (400 300)</p>
  
  <p>So what ever is happening is doubling the size - not - as I previously thought - not updating with the new size.</p>
  
  <p>Does this make it clearer or more of a puzzle?</p>
  
  <p>And talking of puzzles I got a -1 but no one said why.</p>