title: Swift 3.0 writing Image to Directory
body: <p>I have a simple <code>ImagePicker</code> for the user to select, or take, a profile picture. I want to save this <code>image</code> to the <code>Home</code> <code>Directory</code> for easy loading later. </p>
  
  <p>The problem is with the Image type not being set. </p>
  
  <pre><code>    //Save Image
      _ = PPimagePicked.image
      let imageData = UIImageJPEGRepresentation(PPimagePicked.image!, 0.6)
      let compressedJPGImage = UIImage(data: imageData!)
      UIImageWriteToSavedPhotosAlbum(compressedJPGImage!, nil, nil, nil)
      // Get Document Root Path
      let path = URL(fileURLWithPath: NSHomeDirectory()).appendingPathComponent("Documents/profile.jpg")
      do {
          //Save image to Root
          try imageData?.write(to: path, options:  .atomic)
          print("Saved To Root")
      } catch let error {
          print(error)
      }
  </code></pre>
  
  <p>The exact Error is : </p>
  
  <blockquote>
    <p>"[Generic] Creating an image format with an unknown type is an error"</p>
  </blockquote>