Anki Image Reshaper is an add-on for the desktop version of the spaced repetition software Anki. It provides functionality to automatically adjust the size and alignment of images pasted or drag-and-dropped into the editor.
In Anki's default configuration, inserted images are displayed at their original resolution, which can cause high-resolution images to overflow the card boundaries and impair visibility. By installing this add-on, users can collectively manage the maximum width, minimum width, and alignment (left, center, right) of images based on predefined "strategies".
Key features include:
- Automatic Resizing: Instantly applies configured styles when images are pasted or drag-and-dropped.
- Strategy Switching: Allows easy switching between multiple settings such as "Standard", "Icon", and "Full Width" via buttons on the editor toolbar.
- Deck-Specific Defaults: Enables the specification of different default strategies for each learning deck.
This add-on hooks into Anki's editor function and operates by directly manipulating the width attribute and CSS properties of <img> tags within the HTML content. It modifies display styles (such as display and margin) without processing or compressing the image data itself, thereby optimizing the display size while preserving the original image quality.
- Open the "Add-ons" dialog from the "Tools" menu in Anki.
- Click "View Files" and place the add-on files into the opened folder.
- Restart Anki.
Clicking the "Img Format" button added to the editor toolbar opens a dialog for selecting an image sizing strategy. The selected strategy is maintained for that editor session.
When an image is pasted from the clipboard or drag-and-dropped from a file, CSS styles are automatically applied based on the currently selected strategy.
To apply styles to images that have already been inserted, clicking the "Apply" button will process all images within the current field.
Add-on settings are managed via the config.json file. The main configuration items are:
strategies: Specific parameters for each strategy (maximum width, minimum width, alignment).deck_defaults: Associations between deck names and default strategies.resize_on_paste: Toggles the automatic resizing function (trueorfalse).
Example:
{
"strategies": {
"Standard": {
"max_width": 500,
"alignment": "center"
}
},
"default_strategy": "Standard"
}- BeautifulSoup4: Used for HTML parsing. Typically included in the standard distribution of Anki.
GNU General Public License v3.0