Image occlusions not working?

1,586 views
Skip to first unread message

Neill Alexander

unread,
Apr 3, 2015, 10:43:27 AM4/3/15
to anki-a...@googlegroups.com
I have quite a few cards which I have created with the Anki desktop "Image Occlusion 2" add on. For some reason they are no longer working properly in Ankidroid. When the card comes up to study, previously the areas of the image were blanked out - on the desktop version they show up as red. But now in Ankidroid they are blanked out, but in white. So when I have more than one part of the image blocked out on a card, with a separate card for each blank, I can't tell which one that card relates to.

I've attached a demo which contains 2 cards. The full text reads "Assured Shorthold Tenancy Agreement". Card 1 has 'assured' blanked out. Card 2 has 'tenancy'. On the desktop version this works, on Ankidroid they are white. I've attached desktop versions, and screen grabs from my phone from Ankidroid.

Has something changed in the app? This used to work. I have a lot of cards in private decks which I have created in this way.

Any help would be appreciated.
Demo.apkg
card1ankidroid.png
card2.PNG
card2ankidroid.png
card1.PNG

Tim

unread,
Apr 3, 2015, 10:54:23 AM4/3/15
to anki-a...@googlegroups.com
you're like the 4th guy to ask about this, can you try searching the forum please

Neill Alexander

unread,
Apr 3, 2015, 10:57:58 AM4/3/15
to anki-a...@googlegroups.com
Well, that's embarrassing. I searched the other night but didn't find anything, but that was before I'd checked the name of the add on. Should have searched again for "image occlusion" I guess.

Apologies. Thanks for the response.

Neill Alexander

unread,
Apr 3, 2015, 12:33:38 PM4/3/15
to anki-a...@googlegroups.com
Just in case anyone wants to fix their "Image Occlusion" cards to work on Android 5.1, I've written a quick bash script to fix the svg tags. See the attached file.

You require 'zip' and 'unzip' to be available on the path for this to work. I ran it on Windows using Cygwin.

Export all your files to a directory, then run 'fix-anki.sh' from within that directory.

Use this at your own risk - make back ups first! The script does make backups of the files, but you should probably make your own backups to be sure.

If you export with all the schedule information, you can then delete the cards, re-import the updated version, and the image occlusion cards should now work.
fix-anki.sh

Neill Alexander

unread,
Apr 3, 2015, 12:44:27 PM4/3/15
to anki-a...@googlegroups.com
And finally, if you go to https://github.com/mrestko/image-occlusion-2 and use the "Download zip" button, that person has merged in the fix for the svg. You can then replace the "Image Occlusion" add on in the add-ons directory with the fixed version. I've just tried it and it all works again.

Nicolas Raoul

unread,
Apr 3, 2015, 1:12:17 PM4/3/15
to anki-android
Thanks for the script and tips! :-)

Nicolas Raoul

--
You received this message because you are subscribed to the Google Groups "AnkiDroid" group.
To unsubscribe from this group and stop receiving emails from it, send an email to anki-android...@googlegroups.com.
To post to this group, send email to anki-a...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/anki-android/45a0bfaf-69b2-4459-8c4b-a720bbed913e%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Neill Alexander

unread,
Apr 3, 2015, 1:13:59 PM4/3/15
to anki-a...@googlegroups.com
No problem. Thought I'd better add some value to the discussion after neglecting to do a basic search of the forum earlier ;-)

aloysi...@gmail.com

unread,
Aug 24, 2015, 4:31:41 AM8/24/15
to AnkiDroid
Hi Neill,

I've been trying to work around fixing my old occluded cards with your code but received the following error:

: command not found: 

: command not found: 

'ix-anki.sh: line 9: syntax error near unexpected token `do

'ix-anki.sh: line 9: `do


I also tried using the code provided by https://github.com/mrestko/image-occlusion-svg-fix and was also hit by an error:    


from lxml import etree

ImportError: No module named lxml


Think you could help me out?

Tim

unread,
Aug 24, 2015, 4:59:31 AM8/24/15
to AnkiDroid, aloysi...@gmail.com
"No module named lxml" most likely means exactly what it says...
Try installing that module into your python environment. For example using easy_install

Tim

unread,
Aug 24, 2015, 5:03:14 AM8/24/15
to AnkiDroid, aloysi...@gmail.com
It looks like the link I gave doesn't have any images included... 
If it's not much use you can try googling "easy_install windows tutorial" or something (assuming you're on Windows)...
You can also use pip instead of easy_install, it might be faster to get that working.

Aloysius Ng

unread,
Aug 24, 2015, 7:58:44 AM8/24/15
to Tim, AnkiDroid
Hi Tim,

Managed to fix the Lxml issue thanks!

Now another problem came up:

Found 0 Image Occlusion files

Fixed 0 files


Even though I ran the script within the same directory.


Kindest Regards,
Aloysius Ng

xequ...@gmail.com

unread,
Sep 3, 2015, 9:22:28 AM9/3/15
to AnkiDroid
For me this script doesn't do anything. After executing it in cygwin it says:

MSSurface3Pro@DESKTOP-1B4PA4T /cygdrive/c/Users/MSSurface3Pro/Documents/Anki/Xequitep/collection.media
$ bash fix-anki.sh
fix-anki.sh: line 2: $'\r': command not found
fix-anki.sh: line 6: $'\r': command not found
fix-anki.sh: line 9: syntax error near unexpected token `$'do\r''
'ix-anki.sh: line 9: `do

xequ...@gmail.com

unread,
Sep 3, 2015, 9:22:28 AM9/3/15
to AnkiDroid, aloysi...@gmail.com
Hi! How were you able to run the script with using that python command? I've been trying to search and find information for couple of hours about it, checking the Python manual and everything but I can't find out how to run those commands from python cmd. I've tried to use suggested commands, enabling stuff from installator and all but I can't just get it to work. I've hit "running cmd commands from Python" and "navigating to folders in Python" but I get nothing that works and I'm losing my mind.

So I have Python 3.4.3 installed now and I have the python file in my media.collection folder. Any easy instructions how to run that file with the python file from python cmd? Thanks for any help!

james...@gmail.com

unread,
Sep 23, 2015, 7:12:53 AM9/23/15
to AnkiDroid, xequ...@gmail.com
You saved the file with windows EOL terminators which includes newline "\n" and carriage return "\r". Save it as with unix EOL ("\n" only)

Tim

unread,
Jan 21, 2016, 9:21:32 PM1/21/16
to AnkiDroid, xequ...@gmail.com
For future reference, please refer to the FAQ, where I have just added a new entry for this issue: 

rachel.e...@gmail.com

unread,
Jan 22, 2016, 3:18:55 PM1/22/16
to AnkiDroid, perceptu...@gmail.com, aloysi...@gmail.com
Hi Aloysius,

I'm at the same point and error message that you were. Did you ever figure out a solution?

Thanks,
- Rachel
Reply all
Reply to author
Forward
0 new messages