# Possible bug: Edited images don't update the card without a software restart

**URL:** <https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649>\
**Category:** Help\
**Created:** [March 20, 2025, 10:06am UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649 "2025-03-20T10:06:40Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![MechtEngineer](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@MechtEngineer](https://forums.ankiweb.net/u/MechtEngineer)\
**Post date:** [March 20, 2025, 10:06am UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649/1 "2025-03-20T10:06:40Z")

</div>

I’m a long-time user of Anki. So thankful for the developers and community!

When I’m editing a card on my Windows PC version of Anki, I right-click on an image and click “Open image” to edit it. After editing the image (e.g. cropping and saving), and closing the “Edit” window for the card, all the new text changes update, but the image doesn’t update on the card until I do a restart of the software.

The image has definitely been updated. When I go back to try and edit what appears to be an “unchanged image” on the Anki edit window, turns out to be the edited image once I open it with the standard Windows basic photo editor. So the edits are saving successfully to the file (I save the image using the same file), but Anki is not updating the card image until a software restart.

Is this intentional (for a reason not apparent to me)? Is this a bug? Is this only a problem with my version of Anki, and I need to reinstall it?

The issue still occurs when I disable both my add-ons.

Software versions and other information - copied from Anki’s About page:

> Anki 24.11 (87ccd24e) (ao)  
> Python 3.9.18 Qt 6.6.2 PyQt 6.6.1  
> Platform: Windows-10-10.0.26100
> 
> ===Add-ons (active)===  
> (add-on provided name [Add-on folder, installed at, version, is config changed])  
> Advanced Review Bottom Bar [‘1136455830’, 2024-08-22T14:04, ‘None’, mod]  
> Review Heatmap [‘1771074083’, 2022-06-30T04:43, ‘None’, ‘’]
> 
> ===IDs of active AnkiWeb add-ons===  
> 1136455830 1771074083
> 
> ===Add-ons (inactive)===  
> (add-on provided name [Add-on folder, installed at, version, is config changed])

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [March 21, 2025, 1:36pm UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649/2 "2025-03-21T13:36:44Z")

</div>

Images are cached for better performance. You can try this code to disable that (untested):

```auto
import mimetypes

from flask import Response

from aqt.editor import pics
from aqt.mediasrv import app as flask_app

image_types = [mimetypes.guess_type(f"test.{ext}")[0] for ext in pics]

@flask_app.after_request
def disable_caching_for_images(response: Response) -> Response:
    if response.mimetype in image_types:
        response.cache_control.max_age = 0
    return response

```

To use this as an add-on:

- Go to _Tools \> Add-ons \> Show Files_ to open your add-ons folder
- Create a new folder there with any name.
- Create a file in that folder named ` __init__ py` and paste the code there.
- Restart Anki.

---

<div class="post-metadata">

**Author:** ![MechtEngineer](https://avatars.discourse-cdn.com/v4/letter/m/c68b51/32.png) [@MechtEngineer](https://forums.ankiweb.net/u/MechtEngineer)\
**Post date:** [March 24, 2025, 7:06am UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649/3 "2025-03-24T07:06:56Z")

</div>

Thanks so much, abdo! I really appreciate it. 👏

OK, so the images are cached for better performance. Fair enough. It’s not a bug after all then but part of the design. 👍

I haven’t tried your code. I’m a bit nervous to try it because it is untested, and I’m happy with the “if it ain’t broke, don’t fix it” philosophy at the moment. I edit almost every card’s image at the moment, but I don’t mind restarting Anki every now and then through the day.

Thanks again for the generosity of your time and effort to help and explain! 😀

---

<div class="post-metadata">

**Author:** ![SuhasK](https://avatars.discourse-cdn.com/v4/letter/s/bbe5ce/32.png) [@SuhasK](https://forums.ankiweb.net/u/SuhasK)\
**Post date:** [March 24, 2025, 11:33am UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649/4 "2025-03-24T11:33:32Z")

</div>

[https://ankiweb.net/shared/info/1827331674](https://ankiweb.net/shared/info/1827331674)  
Maybe this could help for a faster restart

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [March 24, 2025, 9:52pm UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649/5 "2025-03-24T21:52:39Z")

</div>

> [@MechtEngineer](#):
>
> I haven’t tried your code. I’m a bit nervous to try it because it is untested

It’s totally safe to run. it won’t edit your images.

---

<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:** [April 23, 2025, 9:53pm UTC](https://forums.ankiweb.net/t/possible-bug-edited-images-dont-update-the-card-without-a-software-restart/57649/6 "2025-04-23T21:53:20Z")

</div>

Closed on April 23, 2025, 9:53pm UTC

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