Bing Static Map Image type

2019-08-29 13:13发布

问题:

May I know how to determine the output of Bing map static image? Previously it used to be in png but now it is in jpeg. May I know how to revert back to png format?

Example: Display the image with the link below:

http://dev.virtualearth.net/REST/V1/Imagery/Map/Road/space%20needle,seattle?mapLayer=TrafficFlow&mapVersion=v1&key=BingKey

The image is in jpeg. How to make it to png? Thanks.

回答1:

I don't think you can request the image in a different format.

From http://msdn.microsoft.com/en-us/library/ff701724.aspx :

This URL returns an image in one of the following formats:

  • PNG (image/png)
  • JPEG (image/jpeg)
  • GIF (image/gif)

You cannot specify the output format for the map image. The image type is chosen based on parameters such as imagerySet.

If you really want a PNG, you could make the request from a server-side script and then construct a PNG file programmatically before serving that back to the client (using PHP's imagepng function, for example)



回答2:

I know it's a while you posted this question, but as there is no answer yet, and I got here via Google I'll supply an answer anyway.

You can use the format / fmt parameter.

From: http://msdn.microsoft.com/en-us/library/ff701724.aspx

One of the following image format values:

  1. gif: Use GIF image format.

  2. jpeg: Use JPEG image format. JPEG format is the default for Road, Aerial and AerialWithLabels imagery.

  3. png: Use PNG image format. PNG is the default format for CollinsBart and OrdnanceSurvey imagery.

Examples:

format=jpeg

fmt=gif