deanishe Posted April 30, 2015 Posted April 30, 2015 (edited) 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 workflowis 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 morethan one image file is selected, only the first will be used. Licence This workflow is released under the MIT License. Edited March 21, 2016 by deanishe nicola.efflandrin, vdesabou, thanasut and 1 other 3 1
homever Posted May 4, 2015 Posted May 4, 2015 (edited) I've been looking for this for too long. Thank you! Edited May 4, 2015 by homever
salmone Posted May 29, 2016 Posted May 29, 2016 (edited) 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 May 29, 2016 by salmone thanasut 1
salmone Posted May 29, 2016 Posted May 29, 2016 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 “"”)
nikivi Posted August 16, 2017 Posted August 16, 2017 (edited) 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 August 16, 2017 by nikivi
sr_navarre Posted September 28, 2017 Posted September 28, 2017 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!
deanishe Posted September 28, 2017 Author Posted September 28, 2017 You’ll have to provide more information first.
sr_navarre Posted September 28, 2017 Posted September 28, 2017 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.
deanishe Posted September 28, 2017 Author Posted September 28, 2017 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.
sr_navarre Posted September 28, 2017 Posted September 28, 2017 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
deanishe Posted September 28, 2017 Author Posted September 28, 2017 Hmm. Works for me (on Sierra). Try v2.0.1. I've added logging, which should provide a bit more information on what's going on.
sr_navarre Posted September 28, 2017 Posted September 28, 2017 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&h1=en&bih=179&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 Hope that helps.
deanishe Posted September 28, 2017 Author Posted September 28, 2017 That's perfect. I can see exactly what the problem is. Give me a few minutes to upload a fix…
deanishe Posted September 28, 2017 Author Posted September 28, 2017 Try v2.0.2. I couldn't verify it's fixed (I don't have High Sierra), but it should now work for you. nicola.efflandrin 1
thanasut Posted October 2, 2017 Posted October 2, 2017 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
Stooovie Posted April 8, 2020 Posted April 8, 2020 (edited) 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 April 8, 2020 by Stooovie
andy4222 Posted February 23, 2022 Posted February 23, 2022 @deanishe This workflow doesn't seem to working. Do we need to make changes before running this? error: [23:30:38.514] ERROR: Google Similar Images[Run Script] uploading u'/Users/<USER>/Downloads/CoolBeans/Images/americano@2x.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/<USER>/Downloads/CoolBeans/Images/americano@2x.jpg', 'https://www.google.com/searchbyimage/upload'] Traceback (most recent call last): File "url_for_image.py", line 95, in <module> sys.exit(main()) File "url_for_image.py", line 88, in main url = similar_images_url(filepath) File "url_for_image.py", line 68, in similar_images_url output = subprocess.check_output(cmd) File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 223, in check_output raise CalledProcessError(retcode, cmd, output=output) subprocess.CalledProcessError: Command '['/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/<USER>/Downloads/CoolBeans/Images/americano@2x.jpg', 'https://www.google.com/searchbyimage/upload']' returned non-zero exit status 7 [23:30:38.516] Google Similar Images[Run Script] Processing complete [23:30:38.524] Google Similar Images[Run Script] Passing output '' to Run Script
PeterinJapan Posted May 16, 2022 Posted May 16, 2022 May I reopen this old thread? I am trying to use this workflow in Alfred 4 on a M1 iMac and OS 12.3.1. I get this error: [13:35:10.765] Logging Started... [13:35:57.793] Logging Stopped. [13:36:02.187] Logging Started... [13:36:08.065] Google Similar Images[Hotkey] Processing complete [13:36:08.072] Google Similar Images[Hotkey] Passing output '' to Run Script [13:36:08.235] ERROR: Google Similar Images[Run Script] ./call_with_finder_selection.applescript:1118:1119: script error: Expected end of line, etc. but found “"”. (-2741) [13:36:08.239] Google Similar Images[Run Script] Processing complete [13:36:08.240] Google Similar Images[Run Script] Passing output '' to Post Notification I have Python3 (installed via homebrew) in, and wasn't sure if I needed to update lines in the workflow like /usr/bin/python url_for_image.py "$1" to refer to where my python is? Which is in /Library/Frameworks/Python.framework/Versions/3.10/bin/python3
vitor Posted May 16, 2022 Posted May 16, 2022 Took a look and it seems something changed in the response Google provided the Workflow. It may not be fixable.
PeterinJapan Posted May 18, 2022 Posted May 18, 2022 Thanks. I am in another thread on the Keyboard Maestro forums and the person says the workflow works for him. Not sure why it's not working for me. Can you tell me how you installed Python? Using Homebrew it installs "python3" and the Python commands in the workflow don't work, which feels like it might be part of the issue. Can you tell me what the "best" way to install Python is, and maybe tell me where it should be installed? I only have python3 in /Library/Frameworks/Python.framework/Versions/3.10/bin/python3, currently
nicola.efflandrin Posted November 20, 2022 Posted November 20, 2022 (edited) Hi all, may someone help me understand what i'm doing wrong? M1 MacbookPro 13.0.1 Workflow version 2.1.1 Installed Python 3 (Thanks to deanishe for all the workflow and the support given through the years) Error log [16:29:43.274] ERROR: Google Similar Images[Run Script] Traceback (most recent call last): File "/Users/nicolaefflandrin/Dropbox/Cloud Services/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9F15584E-5AB0-4447-B21E-DE92D82FC37C/url_for_image.py", line 95, in <module> sys.exit(main()) File "/Users/nicolaefflandrin/Dropbox/Cloud Services/Sync/Alfred/Alfred.alfredpreferences/workflows/user.workflow.9F15584E-5AB0-4447-B21E-DE92D82FC37C/url_for_image.py", line 85, in main filepath = args[0].decode('utf-8') AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'? Thanks to who will have time and patience to help me. 🙂 Edited November 20, 2022 by nicola.efflandrin Thanking Deanishe
CuteCat Posted January 16 Posted January 16 trying to find a google image search workflow and i came across deanishe's one here: https://github.com/deanishe/alfred-similar-image-search it's not for alfred 5 though, was wondering if an updated one exists?
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now