Jump to content
deanishe

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

Share this post


Link to post

This workflow seems very useful, but I'm having troubles using it, is there a guide somewhere? 

I tried choosing a shortcut in "hotkey" node but selecting an image in finder and hitting the shortcut I get no results.

Edited by salmone

Share this post


Link to post

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 “"”)

Share this post


Link to post

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

Share this post


Link to post

I use this workflow all the time, but since I updated to the new version of Alfred and High Sierra, it pulls up the workflow folder in Finder instead of searching Google. Is there any chance you could update the workflow? Thanks!

Share this post


Link to post

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.

Share this post


Link to post
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.

 

Share this post


Link to post

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

Share this post


Link to post

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.

Share this post


Link to post
On 5/29/2016 at 3:07 PM, salmone said:

This workflow seems very useful, but I'm having troubles using it, is there a guide somewhere? 

I tried choosing a shortcut in "hotkey" node but selecting an image in finder and hitting the shortcut I get no results.

+1

Share this post


Link to post

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...