Google image search: How do I construct a reverse image search URL?

This is my best guess for how the image search works:

The data in the URL is not an encoded form of the image. The data is an image fingerprint used for fuzzy matching.

You should notice that when you upload an image for searching, it is a 2 step process. The first step uploads the image via the url http://images.google.com/searchbyimage/upload. The Google server returns the fingerprint. The browser is then redirected to a search page with a query string based on the fingerprint.

Unless Google publishes the algorithm for generating the fingerprint, you will be unable to generate the search query string from within your application. Until then, you can have your application post the image to the upload URI. You should be able to parse the response and construct the query string.

EDIT

These are the keys and values sent to the server when I uploaded a file.

image_url       =
btnG            = Search
encoded_image   = // the binary image content goes here
image_content   =
filename        =
hl              = en
bih             = 507
biw             = 1920

“bih” and “biw” look like dimensions, but do not corrispond to the uploaded file.

Use this information at your own risk. It is an undocumented api that could change and break your application.

Leave a Comment