11 0
Contact Author Sign in to rate

OpenInExternalEditor,Rename,Duplicate for Image,Audio,Video

0.02MB. Updated 2022-07-06.
The author has shared 74 other item(s).

Description

This add-on handles images, sound files, and videos: You can open them in an external program: e.g. you can open images in paint or "paint​.NET" and edit them, add some text or arrows, crop them, etc. You can also duplicate the files. You can also rename them to e.g. later find them better when you are searching. This add-on adds context menu entries when you rightclick on an image (left screenshot below) or for audio/video when you have selected the whole "[sound:...]" text (middle screenshot below). This add-on mainly works in the editor (AddCards Dialog, bottom of the browser). During reviews you'll have fewer context menu entries. Use this at your own risk. # Details - edit the file in an external application. If you edit an image and don't use a Mac the editor is reloaded by default so that your changes are shown. - duplicate the file. A copy will be put into the media folder and it will be inserted right after the current file in the editor. By default a number is appended ("_1","_2"). If shift is pressed when you click duplicate in the context menu you can select the new file name. This function might be more useful if you also use the add-on Copy notes (in the browser) or Frozen Fields or Field History (in the add window). - rename the file. By default this is disabled because this is experimental. If you use this make sure to have backups and know how to restore them. - show in file manager. By default this is disabled. - edit an empty file and edit it. I use this as an alternative for DrawingPad on machines where I don't have Java or when I need extended drawing options (see the right screenshot above) # Limitations - In 2.1.50 the image to rename, etc may not be selected (be in resize mode) when right clicking it. - if the rename function does not work edited notes would be permanently damaged so that you would have to manually reinsert the images. That could be time consuming. The rename function has been included in the add-on for about a year and ankiweb shows me that it has been downloaded several hundred times. So far I haven't got a complaint. This could mean that it works or maybe it doesn't and it's just that no one is using the rename function so far. - If you set the option "block_Anki" to "true" you might see unexpected behavior, see the section Configuration below. - I don't have a Mac so I can't test what works on a Mac. The code for Macs has been tested, fixed, and extended by yhlai-code (2020-04) and OjisanSeiuchi (in 2022). # Configuration Most of the options names should be self-explanatory. - You must adjust the programs you use. The options with external_program refer to a program name. Depending on your system it might be enough to use a short command like mspaint (on Windows) or pinta (on linux). Sometimes you need the exact location. This depends on what you have in your PATH environment variable. In Windows if you use the exact location you need to to replace a single backslash (\) by double \\. This is a limitation of the underlying tools that Anki uses. e.g. if you want to use C:\Program Files\paint.​net\PaintDotNet.​exe you must put C:\\Program Files\\paint.​net\\PaintDotNet.​exe into the config. - image_edit_externally__block_Anki_during_edit has no effect on Mac since I don't have a Mac to test. If "true" you can't use Anki as long as the image processing software is used. This way Anki knows when you close the image processing software. Then Anki reloads the editor so that you immediatly see the changes. If you use this setting and you move the editor window the Anki window might look broken on some systems until you close the image editor. # Problems, Bugs, Errors, Improvements If you find a bug let me know in the official anki support forum, on github. # Versions: - 2022-07-05 fix for rename in 2.1.50+, several improvements for MacOS (thanks @OjisanSeiuchi) - 2022-01-05 fix rename counts (thanks @OjisanSeiuchi) - 2021-12-19 handle unicode chars bug fix (thanks @OjisanSeiuchi) - 2021-12-11 - no error when external binary doesn't exist, preliminary changes for 2.1.50/qt6 - 2020-12-11 fix bug introduced around 2020-11-23/24 - 2020-11-30 partially revert prior - 2020-11-24 just code cleanup - 2020-11-23 sync changes automatically (thanks @d0b3rm4n), adjust to Anki 2.1.28+, changed rename function (using code from BlueGreenMagick's "Image Editor") - 2020-08-06 keep the same card when reloading in the reviewer (made by phu54321) - 2020-07-21 better rename tooltip - 2020-07-20 better linux compatibility - 2020-07-14 add context menu option to copy image/sound path to clipboard (true by default) - 2020-06-30 rename context menu entries (so that they are grouped together), add option to show in fileexplorer to reviewer contextmenu - 2020-04-04 MacOS: show file in finder by 2020 Y. H. Lai (yhlai-code) - 2019-12-09 - 2019-05-16 - 2019-04-10 - 2019-04-07 initial release # Other Authors: see the top of the file edit_insert_rename_duplicate​.py

Download

As add-ons are programs downloaded from the internet, they are potentially malicious. You should only download add-ons you trust.

Supported Anki versions:

To download this add-on, please copy and paste the following code into Anki 2.1:

1560623518

If you were linked to this page from the internet, please open Anki on your computer, go to the Tools menu and then Add-ons>Browse & Install to paste in the code.

All Anki 2.1.x Add-Ons Contact Author

Reviews

on 1639567414
This is what I was looking for! Thank you very much. But there are some errors. When editing and saving images through MSPaint, it sometimes stops in the processing state at ANKI. In this case, I have to turn off ANKI. It occurs quite frequently so makes me hard to use this add-on. :'(
Comment from author
This shouldn't happen. I don't have this issue on windows though windows is not my main operating system. Read https://faqs.ankiweb.net/when-problems-occur.html .

Disable all other add-ons and restart Anki. Does the problem persist after this? If so: which anki version do you use, which version of my add-on (the most recent one from ankiweb?), which MS version do you use?

Since I don't use much windows my knowledge about dealing with windows problems is very limited. You could try a different image editing program? I've heard good things about e.g. paint.net or irfanview? Is it any different with other programs? For the simple image editing that mspaint offers there's also the add-on "Image Editor"

If you decide to answer: make a new issue in my support thread in the anki forum (click the button contact author in the upper right of this page).
on 1618237707
I like it very much. Espacially the customization, because I only need some features.
Thank you very much for your work. (Anki v2.1.43)
on 1615303747
Very useful, thanks!
on 1611958614
Amazing add-on. Allowed me to edit images in Greenshot easily with easy-to-use configuration. Thanks!
on 1611767501
I have long used it to edit images with Paint.net, which is very convenient and easy to learn.

From now on I'm also gonna use it to rename images (which I use more and more), because pasting gives images a generic, pretty meaningless name.
on 1607544519
First of all, I would like to thank you for your addon, it has been very useful lately!
Unfortunately since the last updated I don't know why it doesn't work anymore. I use your addon to edit audios in an external program called WavePad, to do that I change the path in "settings" exactly like described below, but since the last update when try to edit the audio files it doesn't open any program. I also tried to edit the file "config.json" in notepad but it doesn't work as well. I hope you can help me with this matter, thanks in advance!

{
"File Manager in Linux and its args": [
"nautilus",
"--select"
],
"image__show_context_menu_entry_for__showInExplorerFinderFileManager": true,
"image__show_context_menu_entry_for__showPathAndPutToClipboard": true,
"image_duplicate__show_in_editor_context_menu": true,
"image_edit_externally__block_Anki_during_edit": true,
"image_edit_externally__program": "mspaint",
"image_edit_externally__show_in_editor_context_menu": true,
"image_edit_externally__show_in_reviewer_context_menu": true,
"image_empty_insert_and_edit__file_from_user_files": "empty.png",
"image_empty_insert_and_edit__show_in_editor_context_menu": true,
"image_rename__show_in_editor_context_menu": true,
"sound__extensions_audio": [
"wav",
"mp3",
"m4a",
"opus",
"ogg",
"oga"
],
"sound__external_program_audio": "C:\\Program Files (x86)\\NCH Software\\WavePad\\wavepad.exe",
"sound__external_program_video": "vlc",
"sound__show_context_menu_entry_for__duplicate": true,
"sound__show_context_menu_entry_for__editExternally": true,
"sound__show_context_menu_entry_for__rename": true,
"sound__show_context_menu_entry_for__showInExplorerFinderFileManager": true,
"sound__show_context_menu_entry_for__showPathAndPutToClipboard": true,
"sound__show_tooltip_two_soundfiles_selected": true
}
Comment from author
Thanks for reporting this bug. Edit: I uploaded a new versions. Could you update your add-ons, restart, and try again. If the problem persists let me know, e.g. at https://forums.ankiweb.net/t/open-in-external-editor-rename-duplicate-for-image-audio-video-official-thread/555
on 1599400960
I only use the rename function and it's great.
I use a copy image buffer function that creates 255 char long file names, so images disappear sometimes via sync and maybe add-ons, or when Ankidroid has been used and synced. I'm convinced this is why images disappear so I rename the files to some more decent "expected" size.
It would be great to have an option to batch rename long files, or autorename as a card is saved but as the function I'm using is already experimental it might be too high risk to implement as a general feature!
Anyway thanks, every useful.
Comment from author
The batch idea sounds useful. I think it would be better fit into a new and separate add-on. I have added the idea to my todo list (but this list is already very long so it'll take a long time).

I labelled the function as "experimental" as a precaution. For me it works and I it should work in general but why risk it? Many people never do backups and the old versions of the database that Anki keeps don't comprise the media folder.
on 1584088878
Hello, I've fixed the bug the other user mentioned above ("Show in Finder" doesn't select the media file). May you take a look on github?
Comment from author
Thank you very much for your commit. I uploaded a new version with your changes on 2020-04-04.
on 1575784787
Another echo from a Mac user (macOS Mojave w. Anki 2.1.15). Unfortunately I haven't been as fortunate as the previous reviewer. What worked in my case was to set the respective lines in the config as follows:

"image__show_context_menu_entry_for__showInExplorerFinderFileManager": true,
"sound__show_context_menu_entry_for__showInExplorerFinderFileManager": true,

When I choose the context menu option “Show this Sound in Finder”, it actually opens the soundfile in my standard editor (and not in the Finder). Specifying other editors, etc. had no effect. The context menu option “Edit this Sound in Finder” was likewise without effect.

A shortcut that allows one to open the file would be extremely helpful.
Comment from author
Thanks for the info.

I have updated the add-on. Now it should open the file manager on your mac. The problem is that I didn't find a way to make the Finder preselect the file you opened. If you have thousands of files in your media collection this would be unfortunate. So you should now see an info window that shows you the name of the file. You can copy this file name and use it to search in the finder window that was just opened.

Does this work for you? Could you also test the other functions from the add-on. The latest release contains multiple under the hood changes.

If you find problems it's easier to continue our conversation on reddit (I'm /u/ijgnord) or on github, https://github.com/ijgnd/anki21__OpenInExternalEditor_Rename_Duplicate_for_Image_Audio_Video
on 1574563545
Using the Config options, I set the external image editor to SeaShore.app (available on the App Store), and it works beautifully on Mac. Thank you very much.
on 1573543467
Very helpful! Thanks