question

JimRose-3876 avatar image
0 Votes"
JimRose-3876 asked JimRose-3876 commented

Web image search sometimes returns incorrect values for thumbnail size

Some queries return the wrong dimensions for thumbnails. E.g. currently a search with a URL like https://api.bing.microsoft.com/v7.0/images/search/?q=nxivm&count=50&offset=0&safeSearch=moderate&setLang=en&mkt=en-US&originalImg=true returns results that have mostly incorrect sizes for the thumbnails, e.g.
"thumbnail": {
"width": 300,
"height": 300
}

when the actual thumbnail image dimensions are different.
This seems to occur for random queries, many other queries will return the correct sizes for all thumbnails. Even with the same query, we have seen it return incorrect results then a week or so later the thumbnail sizes will now be correct. This breaks our app as we rely on correct thumbnail image dimensions in order to show correctly sized thumbnails in the UI.


azure-bing-image
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

@JimRose-3876 Yes, I have noticed this too in some results. There is an option to specify a uniform size to the thumbnails that are returned by specifying the h and w parameters in the thumbnail URI. Details about its usage and more are available in the documentation. I think you can use these options to remediate any incorrect dimensions returned from the response. For example for one of the results in your query. The thumbnail returned is:

https://tse4.mm.bing.net/th?id=OIF.R4R8DNbyOwqvExkPkXDxsQ&pid=Api

Dimensions in response:

     "thumbnail": {
         "width": 300,
         "height": 300
     },

Actual dimensions are:

height: 266 px width: 474 px

We could specify h and w parameters in the above URL and get a uniform size for all images that can be used in the app.

https://tse4.mm.bing.net/th?id=OIF.R4R8DNbyOwqvExkPkXDxsQ&pid=Api&h=300&w=300

If any of the image dimension is below the specified h and w, white padding is added by default.

I hope this helps.



0 Votes 0 ·

Thanks for that info. I'd rather have it return the correct dimensions as it is supposed to without having to hardwire them though, as we want the thumbnails to be scaled versions of the original while maintaining the original aspect ratio. A possible work-around to this bug meantime is to use the original width/height aspect ratio to calculate the correct thumbnail width (since the height seems to be correct in all cases I have seen, just the width is wrong). Would be nice if MS could fix this bug so it would work as intended though. Strange it seems to apply to specific queries and not others, and it seems that the queries that return incorrect sizes will at some point later will actually start returning the correct dimensions,

0 Votes 0 ·

0 Answers