问题
I'm using Google's JSON Custom Search API for a project that involves creating profiles for professional football/soccer players. If I search any player with Google Images regularly and search in a "Player name, Current team" format with the Search Tools set to Type->Face and Advanced Search set to aspect ratio->Square, then I typically get a perfect "profile" headshot as the first result. This would be ideal for the project, as every image has to be square.
Using the aforementioned API, I can do all of this except for the square restriction. I can use a parameter to search for face images and obviously I can set the query. But I cannot find any kind of parameter that would allow me to specify an aspect ratio or even custom sizes. There is a parameter for square image results when I just search with a browser, but it does not produce the same result when using the API.
Is there any possible way to search for just square images? Maybe some other kind of image search API would be more applicable here, it just has to be large enough to have sports-related images from 1992-present, but mostly stuff from 2000+ anyway, so that shouldn't be too much of a problem.
回答1:
Aspect Ratio parameter for google image search is iar
tbs=iar:xw (panaromic)
tbs=iar:s (square)
tbs=iar:t (Tall)
来源:https://stackoverflow.com/questions/13946868/using-the-custom-search-api-rest-json-to-search-for-square-images