Error: "Invalid image or unsupported image format"

The error message "Invalid image or unsupported image format" can be sometimes puzzling, especially when the actual image exists and looks good when viewed in a browser.

Here are some of the usual reasons for this and possible solutions:

  • Images that actually have errors or simply don't exist in the server. A possible solution is to use a plugin like Enable Media Replace to re-upload and replace the images that are broken.
  • A firewall that prevents our servers to access your images. Please whitelist our IPs.
  • Restrictive rules in the .htaccess file. A quick way to check whether .htaccess is the reason for this issue is to temporary change the name of the file to -for example- .htaccess_tmp and then try again to see if the plugin can optimize a newly added image.
  • Wrong WordPress settings. Please check if the URL of your site is correctly set in Settings > General.
  • Unsupported image formats (e.g. .svg).
  • You're using a security plugin that has an option that prevents the images from being properly accessed (e.g. "Long URL strings" option in the iThemes Security plugin)
  • There are sometimes when the error sounds like this "Could not download file (200 OK)". This happens when instead of an image, the website returns an HTML file with HTTP code 200 (which means "everything OK"). Basically the file was downloaded correctly (200 OK) but it isn't actually an image. In our experience usually this happens when there are some firewall restrictions in Cloudflare. Here is a guide on how to debug.

Still need help? Contact Us Contact Us