Image Style Editor
This is an addon for resizing image width and height.
How to use
Right click on an image in editor(Add cards, or in card browser), click on 'Image Styles'.
Accepted formats are: 300, 240px, 20em, 60%, auto,--somestring, empty, etc. Plain numbers(eg. 300) are automatically converted to 300px. Values starting with -- (eg. --name) are automatically converted to var(--name). Trailing and leading spaces are removed.
You can set either only the width or the height, leave the other blank, and the image should retain its aspect ratio. If it doesn't, try going into addon config, and change empty_means to auto. If that still does not work, probably something in your note type styling is overwriting what this addon does, and will need to be modified.
*Note: Please be aware that there is a bug that removes backslashes from the field when you resize an image.
Differences from ImageResizer
- Uses css height and width properties to resize images, so there is no loss of quality.
- You can modify width and height for each image individually
- Can't automatically resize images on paste.
- Can set min-width, max-width, as well as use many other css features.
Image Occlusion Support
This addon supports Image Occlusion notes fully. You can choose to apply style changes to all occlusion cards of the same image, or to all image/mask fields of the card. The previous version (<=v2.1) had a critical bug regarding this feature, view github file to see how to apply the fix.
AnkiDroid Users
- Due to a bug in AnkiDroid, if the note type uses conditional replacement, the note may become blank. Setting
hidden-div-for-image-only-field to true before using editing image style should fix the issue.
Github
https://github.com/BlueGreenMagick/image-style-editor
This is also where you can post issues if you encounter a bug.
Credits
Credits to searene, developer of the addon ImageResizer. Some of the code for gui were reused in this addon.
Also to glutanimate(Aristotelis P.) and others who made the addon Image Occlusion Enhanced, which was how I figured this addon would be possible to make.
Thanks to AnKing for several feature suggestions.
Updated last at 2020-10.17 v2.6. All past releases and changelogs can be viewed here