# Is there a way to prevent the squish/skew of the image in the browser editor?

**URL:** <https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925>\
**Category:** Help\
**Created:** [May 2, 2023, 12:05pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925 "2023-05-02T12:05:47Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [May 2, 2023, 12:05pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/1 "2023-05-02T12:05:47Z")

</div>

I apologize if this has been asked before. I didn’t pull up any related stuff on my searching through the discourse forum here

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/4/4e996e4b43af8fc49286e9be6ab485d075e94fb2.jpeg)

---

<div class="post-metadata">

**Author:** ![kleinerpirat](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kleinerpirat/32/19863_2.png) [@kleinerpirat](https://forums.ankiweb.net/u/kleinerpirat)\
**Post date:** [May 2, 2023, 1:09pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/2 "2023-05-02T13:09:40Z")

</div>

The hard-coded `width` attribute prevents the image from maintaining its aspect ratio when it gets shrunk. In particular, the skew happens when the `width` is set to a value greater than the width it would have in the shrunk state.

I know the attribute gets added when you use Anki’s native image resizing feature, but I’d just batch-remove that attribute and handle image sizes with the card template.

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [May 2, 2023, 1:30pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/3 "2023-05-02T13:30:57Z")

</div>

That much I understand and I do have most of the images controlled with the styling, but there are times when I prefer to use Anki’s native image resizing feature. I would suggest we should look for a way to preserve the aspect ratio when shrunk as nearly every image is likely to have a value greater than the width it would have in the shrunk state. I’m not skilled enough with html/javascript to know if this is even possible, but given that it’s a built in Anki feature, I would suggest we improve on it

---

<div class="post-metadata">

**Author:** ![kleinerpirat](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kleinerpirat/32/19863_2.png) [@kleinerpirat](https://forums.ankiweb.net/u/kleinerpirat)\
**Post date:** [May 2, 2023, 1:45pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/4 "2023-05-02T13:45:11Z")

</div>

Yes, it’s possible to prevent the skewing in Anki.

We could for example apply `width/height: unset` to the greater dimension of a constrained image. I’ll prepare a PR in the evening.

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [May 2, 2023, 1:45pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/5 "2023-05-02T13:45:32Z")

</div>

You’re incredible. I hope you know that

---

<div class="post-metadata">

**Author:** ![zrk](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/zrk/32/12696_2.png) [@zrk](https://forums.ankiweb.net/u/zrk)\
**Post date:** [May 2, 2023, 4:45pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/6 "2023-05-02T16:45:32Z")

</div>

I’m unable to reproduce this. See below. Could you have an addon installed that’s affecting the display?

![widthissue](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/7/7141bfde7ce5baec00bba6b1bd478985337cfe06.png)

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [May 2, 2023, 5:24pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/7 "2023-05-02T17:24:20Z")

</div>

You’re right. It looks like the culprit is the Closet add-on

---

<div class="post-metadata">

**Author:** ![kleinerpirat](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/kleinerpirat/32/19863_2.png) [@kleinerpirat](https://forums.ankiweb.net/u/kleinerpirat)\
**Post date:** [May 2, 2023, 7:12pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/8 "2023-05-02T19:12:20Z")

</div>

While its true that Closet injects CSS that can affect image sizes, the issue is easily reproducible with add-ons disabled.

Just take a picture with a vertical aspect ratio and set the width attribute to some high value. It will be skewed:

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/3/364449af63959205167fa24fac483a181ca34ff4.png)

---

<div class="post-metadata">

**Author:** ![NickFlint](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/nickflint/32/35471_2.png) [@NickFlint](https://forums.ankiweb.net/u/NickFlint)\
**Post date:** [May 2, 2023, 7:13pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/9 "2023-05-02T19:13:23Z")

</div>

Closet was definitely affecting mine with the resize for what it’s worth but your explanation makes sense. Perhaps your solution will fix the closet interaction as well

---

<div class="post-metadata">

**Author:** ![zrk](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/zrk/32/12696_2.png) [@zrk](https://forums.ankiweb.net/u/zrk)\
**Post date:** [May 15, 2023, 5:16pm UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/10 "2023-05-15T17:16:55Z")

</div>

I was wondering why it was working for me and not for kleinerpirat. Apparently this problem affects JPEGs but not PNGs. Maybe it’s a problem in Qt’s web engine?

![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/f/f39529f04e56345cf541eb0ecb77a70666a6bb82.png)

---

<div class="post-metadata">

**Author:** ![dae](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/dae/32/65_2.png) [@dae](https://forums.ankiweb.net/u/dae)\
**Post date:** [May 16, 2023, 5:06am UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/11 "2023-05-16T05:06:19Z")

</div>

Probably more related to their size. Did you try reproduce this with 2.1.63?

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [June 15, 2023, 5:06am UTC](https://forums.ankiweb.net/t/is-there-a-way-to-prevent-the-squish-skew-of-the-image-in-the-browser-editor/29925/12 "2023-06-15T05:06:23Z")

</div>

Closed on June 15, 2023, 5:06am UTC

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