58 3
Contact Author Sign in to rate

Batch Download Pictures From Google Images

8.50MB. Updated 2020-07-09. Only supports Anki 2.1.x.
The author has shared 35 other item(s).

Description

An Anki add-on to batch download pictures from Google Images. 1. Open the card browser - select a few cards - menu Edit - Add Google Images. 2. Select "Source Field". 3. Select "Target Field" instead of "<ignored>". 4. Select how many pictures to download. (optional) 5. Set the maximum width or height. (optional) 6. Click "Start". If the source field contains cloze deletions, only clozes will be used to search for pictures. By default, multiple pictures will be separated by a space character (" "). It can be changed, for example, to a newline character ("<br>") by editing the "Delimiter" option in the config window (Tools - Add-ons - ... - Config). For Anki 2.1.15 The add-on depends on mpv video player to be able to resize pictures. By default, the pictures will be downsized by height to 260 px if mpv video player can be found. On macOS it can be installed via brew.sh and on Linux it should be already installed with Anki 2.1. On Windows download mpv video player from http://mpv.io and update the PATH environment variable. For Anki 2.1.20+ The latest version contains a built-in image resizer but requires Anki 2.1.20+, i.e. there's no need to additionally install mpv video player to be able to resize pictures, but mpv is still required to be able to resize gifs. CHANGELOG 2019-09-12 Initial version 2019-10-18 Add an option to resize pictures 2019-10-25 Ignore HTML tags 2019-12-31 Download multiple images at the same time 2020-01-04 Temporary fix for no module named 'multiprocessing' on Linux. 2020-02-18 Make it work again after Google Images were updated 2020-02-19 Add support for clozes 2020-02-22 Don't resize pictures if mpv is not found 2020-02-26 Add option to overwrite non-empty fields 2020-03-10 Make Google Images work again and be more lenient 2020-04-08 Write images in the main thread 2020-04-15 Compatibility fix for Anki 2.1.15 2020-06-14 Make Google Images work again and be more lenient 2020-06-20 Ignore SSL errors 2020-07-08 Temporarily added a built-in image resizer (Anki 2.1.20+) 2020-07-09 Lazy load external dependencies to prevent update errors - https://i.imgur.com/bSLe2Na.png Nickolay Nonard <kelciour@gmail.com>

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

561924305

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1637791701
AMAZING, thank you so much!!!
on 1631519325
Great work.
on 1627797825
It works great on Mac and Anki ⁨2.1.40.
It's very useful for learning second language. I have no idea of program language and your wonderful work saves much of time of mine.
Thank you so much!! :-D
on 1627577688
Good
on 1627493687
Exactly what I needed, was simple to use and worked on the first try! Thank you!! My Spanish flashcards are a lot better thanks to this add-on.
on 1626441919
This is awesome, but because I'm learning Chinese so sometimes the Google/Bing/ others search engine won't show a appropriate image for the word. Can you add the baidu search engine too? That would be amazing and really helpful for all the Chinese language learner. Thank you so much again~
on 1620737606
Cool
on 1617700695
This looks amazing, and your support here is fantastic too!
Unfortunately, I, too, am receiving an error, and no images being added - I really hope that you could help, as I'd love to be able to use the addon:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.40 (cf446733) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-04-05 13:47:58

Caught exception:
Traceback (most recent call last):
File "anki\notes.py", line 106, in _fieldOrd
KeyError: 'Front'

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "C:\Users\D\AppData\Roaming\Anki2\addons21\561924305\__init__.py", line 368, in <lambda>
a.triggered.connect(lambda _, b=browser: onAddImages(b))
File "C:\Users\D\AppData\Roaming\Anki2\addons21\561924305\__init__.py", line 361, in onAddImages
updateNotes(browser, nids)
File "C:\Users\D\AppData\Roaming\Anki2\addons21\561924305\__init__.py", line 214, in updateNotes
w = note[sf]
File "anki\notes.py", line 111, in __getitem__
File "anki\notes.py", line 108, in _fieldOrd
KeyError: 'Front'
Comment from author
> KeyError: 'Front'

It looks like one of the selected notes has a different note type and doesn't have the Front field.

Maybe use the sidebar or search bar to select cards with only one note type.

https://docs.ankiweb.net/#/browsing?id=sidebar
https://docs.ankiweb.net/#/searching?id=tags-decks-cards-and-notes
on 1615544372
Спасибо! Это замечательное дополнение!
on 1615503100
Took a while to figure out that I just had to change the 'if not empty?' option to append. Also set the target field.
on 1613184523
Love you for this!!!!
on 1612187215
You, sir, are a legend! Thank you very much!
on 1611698503
Thanks so much for this awesome idea. But l could not manage to do it:) l changed the target field and l click on start and then it says processed but nothing changes on flashcard. Can you help me about it please.

And l also wanted to delete it and download it again but i could not delete it either:) l had this warning:

Unable to update or delete add-on. Please start Anki while holding down the shift key to temporarily disable add-ons, then try again.

Debug info: [WinError 124] None: 'C:\\Users\\mee\\AppData\\Roaming\\Anki2\\addons21\\561924~1'

Heyyy, thanks so much for the fast reply:) i did what you said and it worked. i realized that the target place should be empty. On my previous attempts i targeted fields that are filled with some words or sentences. After i tried with my main deck to an empty field, then it worked :)))

I have thousands of cards to memorize so l can not tell you how important it is for me!
Comment from author before post was edited
Thank you too!

I'm not sure where's the problem, but to quickly test the add-on,

1. Create a new Anki profile (File - Switch Profile)
2. Create a new Basic card with "cat" on the Front.
3. Open the add-on and set the "Back" field as the target field.
4. Click Start.

The "processing" message should disappear after 15 seconds or sooner.

If it doesn't work, maybe contact me by email or create a new issue on GitHub - https://github.com/kelciour/batch-download-pictures-from-google-images/issues

To delete the add-on, just do what Anki says.

> Please start Anki while holding down the shift key to temporarily disable add-ons, then try again.
on 1611435838
working as expected
thank you
xxx
on 1610777121
Where have you been all my life?
on 1610545375
Great add-on that has saved me loads of time. Many thanks to the developer.
on 1610058598
One of the very top Anki add-ons. A superb gift to humanity!

####TOP TIP####
If you need to use a combination of source fields, combine this add-on with the also excellent Advanced Copy Fields.
#############
on 1610014829
work, thanks
on 1606992752
Great idea. Thanks a lot. I hope this addon can download images for each word of cloze anki. It'll be awesome.
on 1603818099
Great add on that makes adding images pretty easy, but doesn't work great for Chinese cloze deletion.

To the developer: Please allow a little more customization of what will be searched. I like the idea of auto searching cloze deletions but because I'm learning Chinese this doesn't really work for me. Chinese words are usually made up of two characters. When you only search one character you usually just get a drawing of the character. Nothing really related to the meaning.

Example:
我们要用{{c1::科}}学的方法来教学生。
searches: 科
returns image of: 科
The word is 科学 meaning science. 科 by itself means something about levels, deparments, or branches. Since it isn't really just used as one character I'll get back a drawing of the character itself or something irrelevant.
on 1603027152
I'm really LOVING this AddOn! It makes studying so much more fun
on 1602675616
Super, super useful!! Thank you!! Will help me deal with those cards that I never can seem to remember!
on 1602339907
I had some difficulties initially whereby it would just load forever if I tried to pull in photos from Google Images. After a bit of investigation, I think this may be because some weird image formats were occasionally downloaded (file types that were not .PNG or .JPEG). Instead, I tried pulling images from the other sources (getty, shuttershock, etc) and it worked perfectly for 600+ anki notes all at once.

Overall, very quick and easy to use. You've saved me tens, if not hundreds, of hours on future flashcard creation - Thank you very much!
on 1601216381
Simply the best!
on 1599857154
This amazing addon was the last piece I needed to finalize my Anki setup. Very highly recommend!
on 1598165712
This is so amazing! I'm adding German memes to all my flashcards - because now I can.
on 1598135265
I love you
on 1597229390
Can't believe how useful this is. Well made. Much appreciated. It's a shame to see negative reviews from people who never changed it back to positive, even after the dev fixed their problems...
on 1596879990
ABSOLUTELY ESSENTIAL for all language learners !!!

Images on cards ARE useful, but many of us waste way too much time trying to find the 'right' images.

This marvellous addon should, once and for all, put paid to this 'Image-FOMO' — have (more or less pertinent) images on all cards, yet, don't get an*l about trying to find them :D

.
on 1596028060
Good stuff
on 1596018142
After some playing around with it, I finally got it to work.

UPDATE: THIS IS A MUCH BETTER ADDON THAN I THOUGHT!!! I can choose from which field it picks the word and into which field it adds it! It's a pure bliss once I got the hang of it.

You're a life saver. Just awesome.
on 1595981355
Thank you! works beautifully! thank you for sharing this time saving addon.
on 1595691459
Hi, can you help me? I have 2.1.15 Anki, but I can't find "menu Edit":(
I want to use your add-on to add images to my cards, but I can't:(((

1. Open the card browser - select a few cards - menu Edit - Add Google Images.
2. Select "Source Field".
3. Select "Target Field" instead of "<ignored>".
4. Select how many pictures to download. (optional)
5. Set the maximum width or height. (optional)
6. Click "Start".
Comment from author
https://imgur.com/a/GeVAnt7
on 1594579861
The first your recommendation is working.
thanks a lot

*************************************************
Your plugin does not work for me.
Please help with it.
After the last update I got such an error:

Error
An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed.
If the issue only occurs when add-ons are enabled, please use the Tools > Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem.
When you've discovered the add-on that is causing the problem, please report the issue on the add-on support site.
Debug info:
Anki 2.1.26 (arch-linux-2.1.26-1) Python 3.8.3 Qt 5.15.0 PyQt 5.15.0
Platform: Linux
Flags: frz=False ao=True sv=1
Add-ons, last update check: 2020-07-12 13:19:31
Add-ons possibly involved: ⁨Batch Download Pictures From Google Images⁩

Caught exception:
Traceback (most recent call last):
File "/home/x/.local/share/Anki2/addons21/561924305/__init__.py", line 368, in <lambda>
a.triggered.connect(lambda _, b=browser: onAddImages(b))
File "/home/x/.local/share/Anki2/addons21/561924305/__init__.py", line 361, in onAddImages
updateNotes(browser, nids)
File "/home/x/.local/share/Anki2/addons21/561924305/__init__.py", line 47, in updateNotes
from PIL import Image, ImageSequence, UnidentifiedImageError
ImportError: cannot import name 'UnidentifiedImageError' from 'PIL' (/usr/lib/python3.8/site-packages/PIL/__init__.py)
Comment from author before post was edited
Thank you for the report. Since you're using Arch Linux, I'm not familiar with it, but I guess, you're running Anki from source or something similar, sys.path in Anki contains local Python libraries and Pillow is a bit outdated. It might take some time before the add-on will be updated and at the moment I can think of two possible ways to fix it.

1. Update Pillow to the latest version, i.e. close Anki, open your terminal and run the following command.

python3.8 -m pip install --upgrade Pillow

2. Anki - Tools - Addons - Batch Download... - View Files - open __init__.py in any text editor and replace line #32
from
sys.path.append(os.path.join(os.path.dirname(__file__), "vendor"))
to
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "vendor"))
then close it and restart Anki.
on 1592153831
It works! ( ͡° ͜ʖ ͡°)
on 1590290619
Great add-on!! Good work!!
on 1589528050
breathtaking
on 1589003672
I want to add images to same field without overwriting. is it possible?
As you said, Nothing happens if both fields contain some words or meaning and if I add some pictures to same field until checking the "Overwrite stuff".
-------------------
Working super good :)
Thank you for saving my time to add images manually.
You are Rock!!!!
-------------------
There are a few bugs in it.

1. It is not working when I have TTS sounds related to words. such as "visual [sound:collins!@#!$.mp3]" not working.
If dont have TTS sounds, It works.
2. Pictures are just right next to the letter or meaning, So I had to press "Enter key" one by one.

I hope they will fix it next version. :)
thank you so much :)
Comment from author before post was edited
Yes, it's possible. I'm not sure when the add-on will be updated next time, it will unlikely happen this month, but it can be easily added on your own. I haven't tested it, but it should work if I didn't miss something.

1. Anki - Tools - Add-ons - Batch Download ... - View Files... - open __init__.py in any text editor.
2. Replace the following line (it probably will be a line number 187 or a bit different)
note[fld] = " ".join(imgs)
with
note[fld] += " ".join(imgs)
i.e. replace = with +=
3. Save it, restart Anki, open the add-on and check "Overwrite if not empty".
on 1587570679
Updated to 2.1.22
Not working on 2.1.15 and 2.1.16
Now works great!

Do you think its possible for making a mosaic of 2 or 4 images from the first 4 google results?
Sometimes the first result is not related to the word or expression

Great addon , thank you.
Comment from author
Maybe something with CSS and a bit of JavaScript. I'm pretty sure there's a better way to do it but maybe something like "Google Images 2x2 Template.apkg" - https://drive.google.com/open?id=1erFwUWJULWRBuI_U-ne4eN1aZl8Sh4MI

It's a sample deck with 3 cards in it. The card template can be found here - https://gist.github.com/kelciour/8aff82d8621e14723830cce13bc2ac6c

It looks something like this - https://imgur.com/L2PVbrs

To apply it to your own card template, create a new "Google Images" field and copy everything from the Front Template from the above link to your Front Template and/or Back Template, then copy ".google-images {...}, .google-images > div {...}, img {...}" from the Styling to your Styling section, i.e. everything except ".card" and ".word". Then use the add-on to add 2 or 4 pictures to the "Google Images" field.
on 1586995927
This is great!
on 1586966578
Very cool! Now I can see a picture on every card!
on 1586383108
working great. Thanks
on 1585991956
Super dope add on! Excellent work by the developer!
on 1585781404
Works great!!! Thx for "giphs" function, it's perfect :D
on 1583974598
Works well!! Thank you. Would it be possible to add the image in addition to the existing material of that field instead of completely overwriting it?
on 1582514467
This add on works great now and saves a lot of time when adding pictures to cards. Developer was quick to respond and fix bugs and really cares about his add-on. I would really recommend this add-on for visual learners!
Comment from author before post was edited
Thank you. I was able to reproduce it. Please update the add-on. It should be fixed now but options to resize pictures will be disabled since the add-on won't be able to find mpv video player.

If you'd like to resize pictures please install mpv video player.

1. Download mpv video player as *.7z from https://sourceforge.net/projects/mpv-player-windows/files/stable/
2. Unzip it somewhere.
3. Update the PATH environment variable - https://streamable.com/2b1l6
4. Restart Anki.

Hopefully, I'd have time to add a built-in resizer next week, but as for now it's the only option aside of maybe resizing them later using some external software.
----------------------------
I've just updated it. Could you try it again and let me know if it works or not?
on 1582463858
Excellent addon and support!
Comment from author before post was edited
I don't know how I missed it. Thank you. It should work now.
on 1582382271
Masterpiece, every bug is now fixed, and it works wonder!
Comment from author before post was edited
Thank you. I was able to reproduce it. Please update the add-on. It should be fixed now but options to resize pictures will be disabled since the add-on won't be able to find mpv video player.

If you'd like to resize pictures please install mpv video player.

1. Download mpv video player as *.7z from https://sourceforge.net/projects/mpv-player-windows/files/stable/
2. Unzip it somewhere.
3. Update the PATH environment variable - https://streamable.com/2b1l6
4. Restart Anki.

Hopefully, I'd have time to add a built-in resizer next week, but as for now it's the only option aside of maybe resizing them later using some external software.
----------------------------------
Thank you. This is a very strange error. Could you use Tools - Add-ons - Check for Updates and let me know if it works or not?
on 1582097324
A well-devised, well-implemented and very useful add-on. kelcior even implemented multi-threading in response to a reviewer. Excellent work!

@the reviewer "scammed with some bulls*t image add-on": Maybe it was https://ankiimage.bigcartel.com/ ? To be fair, it did work for me (the version for Anki 2.0, at least).
on 1582063414
Very efficient !
on 1581630947
Stopped working.
Comment from author
It's working now.
on 1581375482
As of 2-10-2020 it does NOT work.
Comment from author
It's been fixed.
on 1581084662
google must have changed something on their end. this program and "Image search" no longer function and return 0 images.
Comment from author
It's been fixed at last!
on 1579632268
Good
on 1578568216
Good addon and thanks for the useful info and links.
on 1578266878
great add bro!
on 1578078339
Some asshole scammed me with some bulls*t image add-on for Anki. I regret that I didn't discover this before buying that other crappy add-on. The images are accurate like 88% of the time. Love it, and thank you, you've saved me a loot of time!
on 1576864070
This is a real lifesaver! Just a quick question: For some reason it takes a really long time to download each image. About 3 to 6 seconds for each. I have an 11.000 card deck and it takes forever. Is this normal? It doesn't seem to be a processing limit on my computer. Could it be an internet speed thing? Thanks!
Comment from author
Thank you for the question. Yes, that's correct. It takes about ~3 or more seconds to download one picture. It takes ~750 ms to get search results from Google Images, ~750 ms to parse them and get the list of images, ~750 ms to download an image and ~750 ms to resize it if mpv is installed.

Could you please update the add-on via Tools - Add-ons - Check for Updates. I've updated the code to download pictures in parallel using multiple threads. It should work a bit faster now and something can be improved in the future to make it a bit faster.
on 1575262839
it works but the images won't resize... could someone share the files (upload to mediafire or whatever) that we're supposed to put in anki??
Comment from author
The official site is https://mpv.io/
For Windows, it can be downloaded from https://sourceforge.net/projects/mpv-player-windows/files
on 1569486667
Works really well.
on 1568041437
nice. thank you.