title: Google image search: How do I construct a reverse image search URL?
body: <p>How can I programmatically through java convert an image to "some string" to pass it as a parameter for searching in google image search. Actually I have made some base64 convertion of image but it differs from that that google does in its image search engine. I've made such a convertion(java 7):</p>
  
  <pre><code>import javax.xml.bind.DatatypeConverter;
  ...
              Path p = Paths.get("my_photo.JPG");
              try(InputStream in = Files.newInputStream(p); 
                      PrintWriter write = new PrintWriter("base64.txt");
                 ) {
                  byte [] bytes = new byte[in.available()];
                  in.read(bytes);
                  String base64 = DatatypeConverter.printBase64Binary(bytes);
                  write.println(base64);
  
              } catch(IOException ex) {
                  ex.printStackTrace();
              }
  </code></pre>
  
  <p>the output of this simple program differs from the google's string in url. I talk about that string that goes after <code>tbs=sbi:AMhZZ...</code></p>