Image Occlusion Enhanced [Official thread]

Glutanimate's Avatar

Glutanimate

13 Oct, 2016 12:25 AM

This is the new official support thread for Image Occlusion Enhanced (old thread). From now on please direct all of your questions about the add-on here.

Thank you!

Showing page 2 out of 9. View the first page

  1. 31 Posted by Glutanimate on 09 Nov, 2016 10:18 PM

    Glutanimate's Avatar

    @Miriam:

    Sounds like some parts of the add-on are missing. Reinstalling it should fix the error.

    @dgbeecher:

    I'm glad you like the button. Great point about the label. I've changed it for the latest release. Thanks also for pointing out the errors in the Wiki. They should be fixed now (alongside some other issues I found).

    Would this field also be editable via the Anki Browser?

    Yes, at least by default.

    what would happen if I added images, text formatting, line breaks, etc. to this field via the Anki Browser, and then tried to view it in the IO Editor?

    I have no idea how the Editor (i.e. SVG-Edit) would handle that, actually. I had only considered plain text field contents. Best case scenario: It would show up as a very long line of HTML code. Worst case scenario: It would crash the Editor. This is probably one of the first things I should check. Wouldn't make much sense to go ahead with this feature if its too unstable.

    @everyone:

    This is it! The stable release of 1.0.0 is out! It's only available on GitHub for now, but I will try to push it to AnkiWeb after I've done some more tests tomorrow. Feel free to give it a try yourself and please report back if you run into any issues whatsoever.

  2. 32 Posted by Glutanimate on 10 Nov, 2016 01:10 PM

    Glutanimate's Avatar

    I've just published v1.0.0 on AnkiWeb.

    Thanks a lot to everyone who has helped with testing (@dgbeecher in particular)!

    Enjoy!

  3. 33 Posted by radroot on 13 Nov, 2016 02:00 PM

    radroot's Avatar

    Hi!
    I was thinking about how it would be nice if image tags with image had width and height properties, so that when you decided to resize image, it would still map to the svg file properly

  4. 34 Posted by radroot on 13 Nov, 2016 02:31 PM

    radroot's Avatar

    Another issue is that with recent update if you choose file from collection, IO recreate that file for no reason.

  5. 35 Posted by Miriam Campeas on 13 Nov, 2016 02:43 PM

    Miriam Campeas's Avatar

    I had one error and you told me to reinstall the image occlusion 2.0. I did and I got farther this time and now another error has appeared.

    An error occurred in an add-on.
    Please post on the add-on forum:
    https://anki.tenderapp.com/discussions/add-ons

    Traceback (most recent call last):
      File "/Users/Miriam/Documents/Anki/addons/image_occlusion_2/image_occlusion.py", line 126, in add_notes_non_overlapping
        header, footer, did)
      File "/Users/Miriam/Documents/Anki/addons/image_occlusion_2/notes_from_svg.py", line 26, in add_notes_non_overlapping
        media_dir = tempfile.mkdtemp(prefix="media-for-anki")
      File "tempfile.pyc", line 333, in mkdtemp
    OSError: [Errno 28] No space left on device: '/var/folders/qq/wcvkb_yn68576rwjghg4vq3c0000gp/T/media-for-ankiJl4kb4'

  6. 36 Posted by Glutanimate on 13 Nov, 2016 03:15 PM

    Glutanimate's Avatar

    @radroot:

    I was thinking about how it would be nice if image tags with image had width and height properties, so that when you decided to resize image, it would still map to the svg file properly

    Do you mean resizing the image when reviewing or when creating the cards? When reviewing, both the base image and its mask are automatically adjusted to the window size. So they're always aligned properly as long as you don't modify the respective styling properties.

    Another issue is that with recent update if you choose file from collection, IO recreate that file for no reason

    Yes, there was a check for this in older versions of IO Enhanced (though not in IO 2.0), but with the new editing feature this is not feasible. Each file belonging to a set of sibling notes (be it the base image or its masks) needs to be uniquely identifiable. Whenever you click on any of the note adding buttons, a completely new set of files will be added to your media collection. This is not very efficient, but makes things much easier on the coding end of the equation.

    Since most users won't be generating multiple occlusion sets per image I think that this is a workable solution for now. Let's not forget that IO worked like this for the longest time. The duplication checks in IO Enhanced <1.0.0 only existed for the past few months.

    I might look into this again when I have more time on my hands. In the meantime feel free to file a pull request on GitHub if you want to implement this yourself.

    @Miriam:

    IO Enhanced just received a major update which should fix a lot of these issues. First please follow the instructions here to remove the older release. Then install the latest update using the download code on the AnkiWeb page.

    As to why this error came up in the first place: Older versions of Image Occlusion create a lot of temporary files when adding notes. These tend to accumulate over the duration of a session and in your case they seem to have actually ended up occupying all of the space in the temporary directory. That's what it looks like, at least (This is the first time I'm seeing an error message like this myself!)

  7. 37 Posted by Miriam Campeas on 13 Nov, 2016 03:38 PM

    Miriam Campeas's Avatar

    Hi,

    You already told me to do this for the last error and I did. I've
    reinstalled it twice now.

  8. 38 Posted by Glutanimate on 13 Nov, 2016 03:47 PM

    Glutanimate's Avatar

    @ Miriam:

    Yes, but the update wasn't out last time we talked. I can tell by the error message that it was produced by an older version of IO. That's why I asked you to update.

    Does the issue still persist after the update?

  9. 39 Posted by radroot on 13 Nov, 2016 06:40 PM

    radroot's Avatar

    [quote]Do you mean resizing the image when reviewing or when creating the cards? When reviewing, both the base image and its mask are automatically adjusted to the window size. So they're always aligned properly as long as you don't modify the respective styling properties.[/quote]
    Resizing image when card is already created. For example, I've created oversized screenshot of the book, say 1000x1000 created some cards and then tried to resize it to the 500x500, obviously svg wouldn't map properly in that case. One way to work around this issue is to create image tags with w/h properties like <img src="image.png" width="189" height="255">
    [quote]Let's not forget that IO worked like this for the longest time. The duplication checks in IO Enhanced <1.0.0 only existed for the past few months.[/quote]
    I'm slowpoke, updated only today :) I feel like all those changes somewhat locks IO within itself. Editing notes is very cool though, I can't believe you achieved that.

  10. 40 Posted by huang.sundi on 16 Nov, 2016 07:40 AM

    huang.sundi's Avatar

    Is there a way to maximize the Image Occlusion SVG editor? Old version allowed it, but I don't see it in the new version.

    Thanks!

    (also, is there a way to have it snap to the edge in Windows? can't remember if the old version did this or not)

  11. 41 Posted by Glutanimate on 16 Nov, 2016 03:00 PM

    Glutanimate's Avatar

    @radroot:

    Resizing image when card is already created. For example, I've created oversized screenshot of the book, say 1000x1000 created some cards and then tried to resize it to the 500x500, obviously svg wouldn't map properly in that case.

    I think I understand what you mean now, but resizing images in place after the fact seems like a very rare usage scenario to me (and something most users wouldn't even know how to do).

    More importantly: I've tried playing around a bit with the width/height attributes and it turns out they don't play too well with Anki and the card template. With the attributes set, the images stop resizing proportionally to the window dimensions. Plus: Anki itself automatically removes these tags from img elements when invoking the HTML field view (CTRL+SHIFT+X).

    So I'm afraid I won't be able to implement this, but you can always use the 'Change image' button in the editing screen to replace your image with a resized version.

    I feel like all those changes somewhat locks IO within itself.

    But these aren't really changes, are they? I don't think there ever was a version of IO that set those img attributes, and safe for the past few months of IO Enhanced, IO 2.0 always used to create duplicate image files in the media directory (something which even Anki itself does when pasting the same image into the editor over again!). So, if anything, IO has always been somewhat 'locked in'.

    Editing notes is very cool though, I can't believe you achieved that.

    Thanks. I honestly didn't think I'd be able to implement this myself, but here we are!

    @huang.sundl:

    Thanks for pointing these issues out! I do most of my testing on Linux, so I hadn't realized that these features got lost somewhere along the way on Windows. Both of these will be fixed in the next release.

  12. 42 Posted by jon.a.seaman on 20 Nov, 2016 11:45 PM

    jon.a.seaman's Avatar

    First off, just want to say that I absolutely love the image occlusion add-on. I'm in medical school and use it daily.

    I've noticed a small glitch that can occur when using a touch-screen computer. If, when making cards using image occlusion, I use the touch screen to drag and create a box, duplicate cards are always created. So if, for instance, I created 4 boxes using the touch screen, when I click to create them, it will say "8 cards have been added". This does not occur when the mouse is used instead.

    Wondering if anyone else has experienced this issue and if a fix is possible. Thanks!

  13. 43 Posted by Glutanimate on 21 Nov, 2016 04:27 PM

    Glutanimate's Avatar

    @jon:

    It sounds like an issue with touch detection in the masks editor. IO uses an external component called SVG-Edit for the drawing interface, which unfortunately can be very buggy at times. My guess is that you're unwittingly drawing small additional shapes that cause IO to generate extra cards (See point 2 here).

    This is likely something I won't be able to fix, but just to be sure: Could you give the older version of IO a try and report back if you're experiencing the same issue there?

  14. 44 Posted by Jan on 24 Nov, 2016 12:20 PM

    Jan's Avatar

    Hi,

    when I take a screenshot on my retina macbook and paste it in Anki the image is blurry and double the actual size. Most apps can handle retina screenshots correctly now - it used to be an issue - but I don't know how to deal with them in Anki to prepare image occlusions. Can you give me a hint?

  15. 45 Posted by Jan on 24 Nov, 2016 01:32 PM

    Jan's Avatar

    Where can I change the default shortcuts?
    The default ALT + O is used to type a Polish character "ó".

  16. 46 Posted by Glutanimate on 24 Nov, 2016 06:45 PM

    Glutanimate's Avatar

    No clue about the screenshot issue, sorry. Don't have an OS X machine at hand. Though maybe someone else might have a solution?

    As for the shortcut: There is no config option for this, yet. You might be able to use the alternate hotkey, though (Alt + A). Also: I'm quite surprised that ALT would be used for composing special character. Isn't this what AltGr is normally assigned to?

  17. Support Staff 47 Posted by Damien Elmes on 25 Nov, 2016 08:22 AM

    Damien Elmes's Avatar
  18. 48 Posted by Jan on 25 Nov, 2016 08:39 AM

    Jan's Avatar

    Damien: thank you. Changing the zoom option does the trick.

  19. 49 Posted by Jan on 25 Nov, 2016 09:08 AM

    Jan's Avatar

    Glutanimate: both AltGr and Alt are represented by Alt/Option on Mac, and as far as I know there's no difference between left and right Alt/Option on MacOs. They're just redundant.

    It's not a huge problem that I can't invoke the shortcut to Add Image Occlusion, the problem is that I can't type in Polish because instead of "ó" the Open File dialog gets triggered every time I press Alt+O.

  20. 50 Posted by Glutanimate on 25 Nov, 2016 09:54 AM

    Glutanimate's Avatar

    Ah, I see. That's a much bigger issue, of course. I will consider making the shortcut configurable in the future. What you can do until then is the following:

    1. Go to your Anki add-ons directory (Tools → Add-ons → Open Add-ons folder) and open image_occlusion_enhanced/main.py in a text editor of your choice
    2. Find this section and replace all instances of _("Alt+a") and _("Alt+o") with a hotkey assignment of your choice
    3. Save the file and restart Anki. The new hotkeys should now be set.

    Please note that updating IO will overwrite these changes.

  21. 51 Posted by Jan on 25 Nov, 2016 10:31 AM

    Jan's Avatar

    Glutanimate: thank you.
    I have replaced “alt+o” with “ctrl+o” and it works fine with “command + o” combination on my Mac.

    For your information, “Alt+a” has no effect here.
    Strangely enough, when I changed “Alt+o” to “Alt+p” OR “Alt+u” it had no effect either. Apparently, keycodes for MacOS are somewhat tricky in python.

    At least, I can use Anki and your wonderful add-on now. Thank you for your time and efforts.

  22. 52 Posted by Jan on 29 Nov, 2016 06:35 AM

    Jan's Avatar

    Remarks field: is it possible to paste an extra image here so that it's displayed after answering on each card created with Image Occlusion?

  23. 53 Posted by dgbeecher on 29 Nov, 2016 10:26 AM

    dgbeecher's Avatar

    Jan: the way I've found to do this is to paste the image into the remarks field of one card in the Anki browser, then to edit that card using the IO Editor. As long as you don't have the Remarks field hidden from the IO Editor, the image from that card will get duplicated to the others cards created from the same original image. I'm not sure if there's an easier way...

  24. 54 Posted by IOE user on 30 Nov, 2016 05:49 AM

    IOE user's Avatar

    Encoding Error with non ASCII character:

    tried to write the word 'arrière' on the label layer, error message:

    Traceback (most recent call last):
      File "/Users/.../Documents/Anki/addons/image_occlusion_enhanced/dialogs.py", line 211, in addAO
        mw.ImgOccAdd.onAddNotesButton("ao", close)
      File "/Users/.../Documents/Anki/addons/image_occlusion_enhanced/main.py", line 228, in onAddNotesButton
        r = gen.generateNotes()
      File "/Users/.../Documents/Anki/addons/image_occlusion_enhanced/ngen.py", line 80, in generateNotes
        ( svg_node, layer_node ) = self._getMnodesAndSetIds()
      File "/Users/.../Documents/Anki/addons/image_occlusion_enhanced/ngen.py", line 195, in _getMnodesAndSetIds
        mask_doc = minidom.parseString(self.new_svg)
      File "xml/dom/minidom.pyc", line 1928, in parseString
      File "xml/dom/expatbuilder.pyc", line 940, in parseString
      File "xml/dom/expatbuilder.pyc", line 223, in parseString
    UnicodeEncodeError: 'ascii' codec can't encode character u'\xe8' in position 796: ordinal not in range(128)

    When I changed it to 'arriere', the IOE-note was created without problem.

    Hope this helps.

    GREAT add-on; wouldn't know what to do without it!

  25. 55 Posted by Glutanimate on 30 Nov, 2016 06:09 AM

    Glutanimate's Avatar

    @IOE User:

    This should be fixed in the latest update (1.0.2). Please give it a try and let me know if everything's working fine.

    @Jan, dgbeecher:

    Here's another way that might be a bit faster: IO will sync fields between Anki's editor and its own editor if they are marked as sticky/frozen. So one way to add an image would be to install the Frozen Fields add-on, mark Remarks as frozen and paste your images in the field before clicking on the IO button. Note: Make sure to clear out the field before clicking on the button again, otherwise the image will also appear on the cards of your next IO session.

  26. 56 Posted by Deyl on 05 Dec, 2016 07:43 PM

    Deyl's Avatar

    Hi, how can I make only one card with hidden data? For example, I hide some necessary information and IOE generates one deck instead by number of hidden fields. Thanks.

  27. 57 Posted by Glutanimate on 08 Dec, 2016 08:01 PM

    Glutanimate's Avatar

    @Deyl: Sorry, but I'm not quite sure I understand. Are you asking if it's possible to make image occlusion notes work like single notes with multiple sibling cards (similar to cloze deletions)?

    If so, then I'm afraid that's not possible. An old version of Image Occlusion 2.0 used to work that way, but it caused too many issues. You can see here for more information.

  28. 58 Posted by Michael on 08 Dec, 2016 08:14 PM

    Michael's Avatar

    Please add that if you want to add transparent pics like png a black backround occurs...

  29. 59 Posted by Glutanimate on 08 Dec, 2016 08:38 PM

    Glutanimate's Avatar

    Michael, I'm sorry, but I can't reproduce that. Transparent PNGs stay transparent for me. Do you have sample image that you could share, so I can take a closer look?

  30. 60 Posted by kingspark on 26 Dec, 2016 02:02 PM

    kingspark's Avatar

    First of all thanks for the great addon!

    My question — It is possible to switch the occlusion mode after the creation of the cards?

Reply to this discussion

Internal reply

Formatting help / Preview (switch to plain text) No formatting (switch to Markdown)

Attaching KB article:

»

Attached Files

You can attach files up to 10MB

If you don't have an account yet, we need to confirm you're human and not a machine trying to post spam.

Keyboard shortcuts

Generic

? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac