Jump to content

Google Search for Similar Images


Recommended Posts

Perform a Google Image search based on files on your computer. The images are uploaded to Google, and the list of search results is shown in your browser.
 
Download
 
Get the workflow from GitHub or Packal.
 
Usage
 
Google search supports PNG, JPG, GIF and BMP images only. This workflow
is available as a File Action for any of these filetypes in Alfred.
 
There is also a Hotkey to search based on the current Finder selection. If more
than one image file is selected, only the first will be used.
 
Licence
 
This workflow is released under the MIT License.

Edited by deanishe
Link to comment
  • 1 year later...

What does Alfred's debugger say?

When I select an image and hit the shortcut I get: 

 

ERROR: action.script] ./call_with_finder_selection.applescript:1120:1121: script error: Si attendeva fine linea, ecc. ma è stato trovato “"”. (-2741)

(in english it is saying that it was expecting end of the line but it found “"”)

Link to comment
  • 1 year later...

Really awesome workflow. Thank you for it.

 

One thing I added is that, user can now take an interactive screenshot and search that on Google. 

 

Here is the modified workflow if you wish to perhaps add it to your own one. :)

 

Edited by nikivi
Link to comment
  • 1 month later...

Here's what the debugger puts out when I run the workflow:

 

[2017-09-28 08:42:44][ERROR: action.script] Traceback (most recent call last):
  File "url_for_image.py", line 85, in <module>
    sys.exit(main())
  File "url_for_image.py", line 80, in main
    raise ValueError("Couldn't understand server response")
ValueError: Couldn't understand server response

 

 

When I double-tap 'command' with an image selected in finder, and select 'Search For Similar Images' in the file action list, instead of searching Google the workflow opens '/Users/MY_NAME/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.4DEF597C-7E7E-4A83-B859-E1627D4C7939' in finder.

 

Is there any other useful information I could provide? Thanks for looking at this.

Link to comment
1 hour ago, sr_navarre said:

Here's what the debugger puts out when I run the workflow:

 

[2017-09-28 08:42:44][ERROR: action.script] Traceback (most recent call last):
  File "url_for_image.py", line 85, in <module>
    sys.exit(main())
  File "url_for_image.py", line 80, in main
    raise ValueError("Couldn't understand server response")
ValueError: Couldn't understand server response

 

Impossible to say without knowing what image you're uploading.

 

At any rate, I've just released v2.0, which will work better with Alfred 3.

 

1 hour ago, sr_navarre said:

When I double-tap 'command' with an image selected in finder, and select 'Search For Similar Images' in the file action list, instead of searching Google the workflow opens '/Users/MY_NAME/Dropbox/Alfred.alfredpreferences/workflows/user.workflow.4DEF597C-7E7E-4A83-B859-E1627D4C7939' in finder.

 

Is that definitely my workflow? There's nothing in my code that would cause that behaviour.

 

2 hours ago, sr_navarre said:

Is there any other useful information I could provide?

 

The image you're trying to search for.

 

Link to comment

I've just tried again with v2.0, and I'm still getting the same response (opening the finder to the folder I mentioned above). This time I tried to search for the image I attached to this reply, and I got the following message in the debugger:

 

[2017-09-28 11:23:24][ERROR: action.script] Traceback (most recent call last):
  File "url_for_image.py", line 85, in <module>
    sys.exit(main())
  File "url_for_image.py", line 80, in main
    raise ValueError("Couldn't understand server response")
ValueError: Couldn't understand server response

 

 

caramelo.thumb.jpg.5623aecbf9d9e9301cd1d5bde63676bb.jpg

Link to comment

Thanks for all your work on this. Here's the debug info for v2.0.1; I attached the image I searched for this time.

 

Starting debug for 'Google Similar Images'

[2017-09-28 13:13:52][ERROR: action.script] uploading u'/Users/MYNAME/Pictures/Backgrounds/kgm58S7.jpg' to Google ...
cmd=['/usr/bin/curl', '--include', '--silent', '--user-agent', 'alfred-similiar-image-search 0.1 ()', '--form', 'image_url=', '--form', 'filename=', '--form', 'h1=en', '--form', 'bih=179', '--form', 'biw=1600', '--form', 'encoded_image=@/Users/MYNAME/Pictures/Backgrounds/kgm58S7.jpg', 'https://www.google.com/searchbyimage/upload']
[response] HTTP/2 302 
[response] location: https://www.google.com/search?tbs=sbi:AMhZZiuf4HqV0Q8qcUIY7HIlG5icYpS2sk04vgdcuPnoutrZz0Ya2xHH-mU1Krau_1irKW5Z6wEiXLB9r_1hgxdBdWbMLN4cKDwEUIG4-Ic32omifoEcE8Kiznh46SszXdq-RhB0RNVYjWAFnEAnALR1hqpGD3koYlz8y9oIetKGIBNHQyL814ekwJTLvUEM748_1DGDcVC2qIu6V2NIvwcleg4OWLPfmQilnWHu6l3ul1hjqISh3r8M5wXpgqOO-QqsR23aTxJTSOqTREz5ySs4WUrL3rXexQ8Rdss7JrMIF-vpfSJjUkXEVK5BGo0Tqij3xhz9BQmgQCCCqD9EgWiqF4eeYwr9zS4Tg&h1=en&bih=179&biw=1600
[response] cache-control: public, max-age=21600
[response] date: Thu, 28 Sep 2017 17:13:58 GMT
[response] expires: Thu, 28 Sep 2017 23:13:58 GMT
[response] content-type: text/html; charset=UTF-8
[response] x-content-type-options: nosniff
[response] server: quimby_frontend
[response] content-length: 627
[response] x-xss-protection: 1; mode=block
[response] x-frame-options: SAMEORIGIN
[response] alt-svc: quic=":443"; ma=2592000; v="39,38,37,35"
[response] 
[response] <HTML><HEAD><meta http-equiv="content-type" content="text/html;charset=utf-8">
[response] <TITLE>302 Moved</TITLE></HEAD><BODY>
[response] <H1>302 Moved</H1>
[response] The document has moved
[response] <A HREF="https://www.google.com/search?tbs=sbi:AMhZZiuf4HqV0Q8qcUIY7HIlG5icYpS2sk04vgdcuPnoutrZz0Ya2xHH-mU1Krau_1irKW5Z6wEiXLB9r_1hgxdBdWbMLN4cKDwEUIG4-Ic32omifoEcE8Kiznh46SszXdq-RhB0RNVYjWAFnEAnALR1hqpGD3koYlz8y9oIetKGIBNHQyL814ekwJTLvUEM748_1DGDcVC2qIu6V2NIvwcleg4OWLPfmQilnWHu6l3ul1hjqISh3r8M5wXpgqOO-QqsR23aTxJTSOqTREz5ySs4WUrL3rXexQ8Rdss7JrMIF-vpfSJjUkXEVK5BGo0Tqij3xhz9BQmgQCCCqD9EgWiqF4eeYwr9zS4Tg&amp;h1=en&amp;bih=179&amp;biw=1600">here</A>.
[response] </BODY></HTML>
[response] 
Traceback (most recent call last):
  File "url_for_image.py", line 95, in <module>
    sys.exit(main())
  File "url_for_image.py", line 90, in main
    raise ValueError("Couldn't understand server response")
ValueError: Couldn't understand server response

 

kgm58S7.thumb.jpg.56f33ff2783a0fdaf4415182434ddc5c.jpg

 

Hope that helps.

Link to comment
  • 2 years later...

This doesn't work in Alfred 4 anymore. I get notification ("Searching for similar images" and that's it. It is super useful, can we get an update?

 

EDIT: spoke to soon. It just took a handful of minutes to open the results page for whatever reason.

Edited by Stooovie
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...