if (resp.http.Content-Type ~ "(?i)(gif|png|jpe?g|webp)" && !req.http.X-Fastly-Imageopto-Api && req.restarts == 0) {
  # Enable IO
  set req.http.X-Fastly-Imageopto-Api = "fastly; qp=*";

  # Restart the request to trigger Fastly IO processing
  restart;
}