title: Getting "The provided image is in an unsupported format" error when trying to insert an image in a Google Slides presentation
body: <p>I am trying to insert an image (PNG) in a Google Slide presentation using the Slides API. I do this by first uploading the image to the user's Drive, obtaining the url, passing that along to the Slide API via the correct request and then deleting the image file.</p>
  
  <p>What used to work as of a few weeks ago:</p>
  
  <pre><code>image_url = '%s&amp;access_token=%s' % (
            drive_service.files().get_media(fileId=image_file_id).uri,
            creds.token)
  </code></pre>
  
  <p>However, there have been <a href="https://cloud.google.com/blog/products/application-development/upcoming-changes-to-the-google-drive-api-and-google-picker-api" rel="nofollow noreferrer">changes to the Drive API</a>, such that URLS constructed this way no longer work.</p>
  
  <p>I am having difficulty figuring out the new correct URL to use here. The options as per the doc that describes the change are:</p>
  
  <ol>
  <li>Use webContentLink -- Downloads</li>
  <li>Use webViewLink -- View</li>
  <li>Use exportLinks -- Export</li>
  </ol>
  
  <p>I use code that looks like this to get these links:</p>
  
  <pre><code> upload = drive_service.files().create(
            body={'name': 'My Image File'},
            media_body=media_body,
            fields='webContentLink, id, webViewLink').execute()
   image_url = upload.get('webContentLink')
  </code></pre>
  
  <p>I have tried both #1 and #2 and get the following error:</p>
  
  <p><code>"Invalid requests[0].createImage: The provided image is in an unsupported format."</code></p>
  
  <p>I have also been receiving the following error intermittently:
  <code>"Invalid requests[0].createImage: Access to the provided image was forbidden."</code></p>
  
  <p>I verified that I am able to download / view the image from the URLs generated in #1 and #2. I didn't try #3 since I am not trying to export to a different format.</p>
  
  <p>What would be the best way to go about figuring out the correct URL to use?</p>