[Bug] Some images cannot be pasted into Anki’s Editor

Problem:
Some images cannot be pasted into Anki’s Editor, although they can be pasted correctly in any other software.

The issue is clearly reproducible with Wiktionary and Wikipedia off-line files from the Kiwix Project.

Steps to Reproduce:

  1. Download a Wikipedia or Wiktionary in .zim format from the “Kiwix Project”. For example, the German Wiktionary (full version):

https://download.kiwix.org/zim/wiktionary_de_all_maxi.zim

  1. Load the “Wiktionary” (.zim file) into GoldenDict-ng.
    Menu > Edit > Dictionaries > Sources (folder where the Wikipedia file is located)

  1. Once the “Wiktionary” is loaded, search a word containing an image. For example:
  • Australien
  • Karies
  • Leberwurst

  1. Right click on any image within GoldenDict-ng (Wiktionary in .zim format) and copy it to the clipboard.
  2. Paste the image in the Anki Editor.
  3. See the error: the image cannot be pasted into the Editor.

The editor fails to paste the image, although the same image can be pasted into any other program. For example:

  • CopyQ (Clipboard manager)
  • The native KDE Clipboard manager
  • Pinta
  • Krita
  • VocabSieve (Sentence Mining with Anki)

Only Anki fails to “accept” an image that is taken is clearly in the clipboard manager.

Expected behaviour:
Images from the clipboard manager should be pasted normally in Anki

Demo Video:
Here is a short video (60 seconds) showing the problem:

OS & Anki Version:
Endeavour OS (Arch Linux)
Anki-bin from the AUR Repository

Anki 23.10.1 (fac9e0ee) Python 3.11.6 Qt 6.6.0 PyQt 6.6.0
Platform: Linux-6.6.2-arch1-1-x86_64-with-glibc2.38
Flags: frz=False ao=True sv=3
Add-ons, last update check: 2023-11-28 18:40:12


===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
ActivityWatch for Anki ['567877061', 2023-10-08T00:05, 'None', '']
Advanced Browser ['874215009', 2023-10-21T16:34, 'None', '']
Alphabetic sort in the browser ['967882190', 2023-10-17T13:21, 'None', '']
AnkiConnect ['2055492159', 2023-10-29T18:44, 'None', '']
Batch Editing ['291119185', 2023-10-26T02:38, 'None', '']
Card Info During Review ['2179254157', 2023-11-14T06:56, 'None', '']
Edit Field During Review Cloze ['385888438', 2023-11-01T05:53, '6.17', mod]
FSRS4Anki Helper ['759844606', 2023-11-28T03:37, 'None', mod]
FastWordQuery-Qt6 ['103636257', 2023-11-17T18:38, 'None', '']
Highlight Search Results in the Browser ['225180905', 2023-10-21T21:17, 'None', '']
Learn now  Grade now ['1021636467', 2023-11-03T04:16, 'None', '']
Mini Format Pack ['295889520', 2023-11-02T19:00, 'None', '']
Paste Images As WebP ['1151815987', 2023-11-03T03:58, 'None', '']
Repetition Bar ['2855055', 2023-11-07T10:24, 'None', '']
Review Hotmouse ['1928346827', 2023-11-03T05:16, '2.7', mod]
Search Stats Extended ['1613056169', 2023-11-12T18:15, 'None', '']
Special Fields ['1102281552', 2023-11-01T17:37, 'None', mod]
ZIM Reader - Look up words in Wiktionary ['951350249', 2023-02-21T22:12, 'None', mod]

===IDs of active AnkiWeb add-ons===
1021636467 103636257 1102281552 1151815987 1613056169 1928346827 2055492159 2179254157 225180905 2855055 291119185 295889520 385888438 567877061 759844606 874215009 951350249 967882190

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
AMBOSS add-on ['0amboss_addon', 2023-10-17T23:29, 'None', '']
More Decks Stats and Time Left ['1556734708', 2023-09-24T16:08, 'None', '']
Multiple Choice for Anki ['1566095810', 2023-11-17T21:59, 'None', '']

Extra:
This issue has been ocurring for many months. I have reproduced it across different distros in Linux and different versions of Anki. The problem persists without Anki Add-ons.


I guess that @abdo could easily reproduce this issue related to “GoldenDict-ng”. I remember that you know about GoldenDict and the 380 GiB collection of dictionaries at “FreeMDict Forum”.

Could you please try to reproduce this bug ? @abdo :pray:

1 Like

GoldenDict apparently uses a custom URL protocol for images:

Anki is not recognizing this as a URL so it’s not trying to download it. I added a trivial fix to make it recognize the bres:// protocol but the download then fails with this error:
image

Interestingly, if you have the Paste Images As WebP add-on installed, the issue goes away. I’ll look into what’s the add-on is doing here to make it work.

1 Like
1 Like

Thanks for your hard work Abdo! :smiley:

I hope “dae” would agree to merge the commit.

This commit was reversed on GitHub by “dae” because it unexpectedly caused other issues:

I wonder if we could find a solution on “GoldenDict-ng” by Xiaoyifang ?

There are not so many users of GoldenDict in comparison with Anki. Therefore, this might be better to fix on the side of the dictionary software.

1 Like

Maybe the simplest solution to suggest to the author is to make GoldenDict only write image data to the clipboard, with no HTML.

The Author of GoldenDict-ng argues that the problem is an Anki’s issue…

I also believe so because copying images from GoldenDict to other software programs work.

Only Anki has a small problem in the way it handles those images. This issue might be worth considering in the future to improve Anki…

Thanks for your hard work @abdo

1 Like

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