# “Error loading image occlusion”

**URL:** <https://forums.ankiweb.net/t/error-loading-image-occlusion/50346>\
**Category:** Help\
**Created:** [October 6, 2024, 3:37am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346 "2024-10-06T03:37:14Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![lizbyamba](https://avatars.discourse-cdn.com/v4/letter/l/ac91a4/32.png) [@lizbyamba](https://forums.ankiweb.net/u/lizbyamba)\
**Post date:** [October 6, 2024, 3:37am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/1 "2024-10-06T03:37:14Z")

</div>

I am not sure why my anki image occlusion does not work on my computer while all my image occlusions work on IOS (iPad and iPhone). I have the most updated version of the image occlusion add on, and the error states on my computer “TypeError: anki.setupImageCloze is not a function”. To add, I make the image occlusion cards on my iPad if that’s any help.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/e/3/e3bbb2904ed5ee44dd1a909ccf08049062a238ce.jpeg)

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [October 6, 2024, 4:27am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/2 "2024-10-06T04:27:47Z")

</div>

Are you making and editing notes in _built-in_ Image Occlusion – or in the Image Occlusion Enhanced _add-on_? You named both of them in your question, but they are separate things and not interchangeable.

You also shouldn’t be editing the card templates for the Image Occlusion note type. If you’ve made changes to that, you may want to replace that note type with a new copy made from the default note type.

---

<div class="post-metadata">

**Author:** ![lizbyamba](https://avatars.discourse-cdn.com/v4/letter/l/ac91a4/32.png) [@lizbyamba](https://forums.ankiweb.net/u/lizbyamba)\
**Post date:** [October 6, 2024, 4:46am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/3 "2024-10-06T04:46:27Z")

</div>

I think I am doing the built in image occlusion(I attached a photo below on what I choose), and sounds good for the second part!

 ![IMG_8589](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/3X/f/0/f08e8fc220564aa2c3dfc13200786666591d7452.jpeg)

---

<div class="post-metadata">

**Author:** ![sorata](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/sorata/32/34115_2.png) [@sorata](https://forums.ankiweb.net/u/sorata)\
**Post date:** [October 6, 2024, 6:15am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/4 "2024-10-06T06:15:07Z")

</div>

Can you tell us your Anki version? If you’re using an older app, it might not support “Image Occlusion” (not enhanced).

To download the latest version, see here.

Actually, it seems you might’ve updated the templates manually. And changed the `anki.imageOcclusion.setup();` part.

Replace your front template with this:

```auto
{{#Header}}<div>{{Header}}</div>{{/Header}}
<div style="display: none">{{cloze:Occlusion}}</div>
<div id="err"></div>
<div id="image-occlusion-container">
    {{Image}}
    <canvas id="image-occlusion-canvas"></canvas>
</div>
<script>
try {
    anki.imageOcclusion.setup();
} catch (exc) {
    document.getElementById("err").innerHTML = `Error loading image occlusion. Is your Anki version up to date?<br><br>${exc}`;
}
</script>

```

And use the following code for your back template:

```auto
{{#Header}}<div>{{Header}}</div>{{/Header}}
<div style="display: none">{{cloze:Occlusion}}</div>
<div id="err"></div>
<div id="image-occlusion-container">
    {{Image}}
    <canvas id="image-occlusion-canvas"></canvas>
</div>
<script>
try {
    anki.imageOcclusion.setup();
} catch (exc) {
    document.getElementById("err").innerHTML = `Error loading image occlusion. Is your Anki version up to date?<br><br>${exc}`;
}
</script>

<div><button id="toggle">Toggle Masks</button></div>
<div>{{Back Extra}}</div>

```

---

<div class="post-metadata">

**Author:** ![Danika\_Dakika](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/danika_dakika/32/17815_2.png) [@Danika\_Dakika](https://forums.ankiweb.net/u/Danika_Dakika)\
**Post date:** [October 6, 2024, 7:14am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/5 "2024-10-06T07:14:23Z")

</div>

Check your version _first_, before you make any _manual_ changes to your templates. The default template you have is the older version – and possibly the one that is necessary to be compatible with your version of Anki.

If your AnkiMobile installs are updated, it might be version mis-match that is causing this issue.

---

<div class="post-metadata">

**Author:** ![lizbyamba](https://avatars.discourse-cdn.com/v4/letter/l/ac91a4/32.png) [@lizbyamba](https://forums.ankiweb.net/u/lizbyamba)\
**Post date:** [October 7, 2024, 3:10am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/6 "2024-10-07T03:10:55Z")

</div>

Unfortunately, I have hundreds of cards and won’t be able to do this for each one. And I did download the latest version as well! I think it might just be an issue that I’ll have to get over eventually😢

---

<div class="post-metadata">

**Author:** ![sorata](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/sorata/32/34115_2.png) [@sorata](https://forums.ankiweb.net/u/sorata)\
**Post date:** [October 7, 2024, 5:31am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/7 "2024-10-07T05:31:33Z")

</div>

> [@lizbyamba](#):
>
> Unfortunately, I have hundreds of cards and won’t be able to do this for each one.

You only need to do it once. The cards are using templates from the same note type. See [Getting Started - Anki Manual](http://docs.ankiweb.net/getting-started.html#card-types).

If this is confusing you by any chance, you can also do it after opening the templates screen the usual way you do it. It’s the same thing as going to **Manage note types** and then selecting the note type.

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [October 8, 2024, 9:44am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/8 "2024-10-08T09:44:53Z")

</div>

You appear to be using an old version of Anki on your computer. Please update again and double-check the version in the about screen, then see if the issue still exists.

---

<div class="post-metadata">

**Author:** ![lizbyamba](https://avatars.discourse-cdn.com/v4/letter/l/ac91a4/32.png) [@lizbyamba](https://forums.ankiweb.net/u/lizbyamba)\
**Post date:** [October 28, 2024, 3:51am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/9 "2024-10-28T03:51:47Z")

</div>

It worked, thank you!!

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [November 27, 2024, 3:52am UTC](https://forums.ankiweb.net/t/error-loading-image-occlusion/50346/10 "2024-11-27T03:52:43Z")

</div>

Closed on November 27, 2024, 3:52am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
