WolframAlpha API 高分辨率图像

WolframAlpha API high resolution images

我正在使用 WolframAlpha API 并尝试下载在 URL 查询中设置 format=plaintext,image 时提供的图像。但是我意识到这些图像的分辨率仅为 AppStore 的 WolframAlpha 应用程序提供的图像分辨率的一半。我也想知道我是怎么得到这些图像的,但是如果不可能的话也是可以理解的。

感谢您的建议。

尝试 mag 参数:

The mag parameter controls the magnification of pod images. (...) Let's say your program will be displaying its results on a very high-density screen like a tablet, with a screen density of 240 pixels per inch and a screen width of 960 pixels (4 inches). If you specify width=900, you will get images that fit the screen, but fonts will be tiny---the images will look shrunken by the high number of pixels per inch. If you specify, say, mag=2, then your images will still be wrapped to fit the 900 pixel screen, but they will be blown up by a factor of 2 and therefore much more readable

要获取主屏幕的比例因子,您可以 let scale = UIScreen.mainScreen().scale 并将其用作 mag 参数。

并且不要忘记,在下载图像并创建 UIImage 的新实例后,明确设置其比例。假设您收到的图像是 NSData,您可以这样做:

let image = UIImage(data, scale: scale)

有关详细信息,请查看 WolframAlpha API Documentation

中的 控制结果宽度 部分