Improving image resizing in editor

This is probably a matter of personal taste, but I find a bit unwieldy the way Anki does not resize images by default anymore (in the browser, editor etc.)

It seems to me that the disadvantage encountered by those who desire all images to be shrunk outweighs the advantage gained by those who do like such behaviour
(i.e. having to double click on each and every image and/or having to use Find and Replace to batch edit existing notes vs not having to double click on an image the times you need to read something).

I read here that this change simplifies calculations, and in fact it does seem to work much more smoothly.
Maybe it would be possible to set a maximum height for all images (instead of an individual property; kind of like Maximum image height and width in card editor - AnkiWeb used to work) and then upon double click add some HTML attribute to allow single images to bypass such limit, similary to how itā€™s now used to shrink them?

(Also: by adding a new ā€˜default maximum height for images in the editorā€™ setting in the Preferences, every user would be able to decide which default image size works best for them)

5 Likes

Weā€™d probably never come to a conclusion, which solution benefits the most. Thereā€™s a huge amount of people, who only take snapshots of PDFs, put them into Anki then create image occlusions. For them, not shrinking is probably better.

Why I chose to do no-shrinking by default is that itā€™s less confusing to a new user. That way they can discover the feature by themselves, and use it as they please.

Your use case could still be covered by an add-on though. It would need to:

  1. Offer an option to add data-editor-shrink="true" to all images (of a notetype? of a deck?) via Find&Replace.
  2. Add data-editor-shrink="true" to all images on paste.

This could certainly come in the future. At the moment Anki will resize it to fit in a 250x125 rectange. Though it should probably be a noteype option, or even a field option.

1 Like

That sounds a bit intrusive. Wouldnā€™t it suffice to restrict max image height with a global CSS rule (that only applies to images when they arenā€™t in ā€œediting modeā€)?

Itā€™s easy to do this with an add-on, but Iā€™d rather have a preferences option inside Anki. Simply allow people to enter the max height and when left blank (default) it doesnā€™t restrict the height.

2 Likes

Maybe the following could be reasonable?
It is a bit more complex, but not too much and perhaps it would cover all use cases.

  • keep the possibility of shrinking the images by adding data-editor-shrink="true" via double click
  • add a configurable global CSS rule that applies to all images (blank by default)
  • add a second button that allows to expand the image and bypass the CSS rule (unclickable if the CSS rule is left blank); e.g. by adding a different attribute

Re: image resizing. I agree that the current method is a bit wonky and not ideal. There are certainly two groups of people. In some cases, I find myself actually wanting both the ability to keep it large and the ability to keep everything small depending on what Iā€™m working with. I would propose:

  • large by default seems to make sense for new users
  • double click to shrink image as it currently is
  • an option in the preferences screen or a button in the editor that has two settings:
    1. large or small by default
    2. adjustable width of the images when shrunk in pixels
2 Likes

There are 3 different ways images get resized:

  1. large images are reduced to fit the width of fields in the editor
  2. images can be double-clicked to shrink them down to a small, pre-determined size in the editor
  3. images can be manually resized to a specific size, which affects both editor and reviewer

This is already potentially a bit confusing, so I hope we can find a way to make everyone happy without adding too much further complexity to either the UI or the code.

For developers, there is a bit of background on the current approach on image changes size when pressing enter Ā· Issue #1804 Ā· ankitects/anki Ā· GitHub. Our data-based approach may make it difficult to support easily changing the default for existing notes (updating the behaviour of newly-added images is easy, but not so useful).

2 Likes

We made a simple add-on to temporarily solve this issue: Shrink Image Size In Editor - AnkiWeb

2 Likes