zsviczian / obsidian-excalidraw-plugin

A plugin to edit and view Excalidraw drawings in Obsidian
4.07k stars 219 forks source link

FR: The aspect ratio of the picture is corrected #1780

Closed jiajiala closed 4 months ago

jiajiala commented 4 months ago

image When I hyperlink a local image into EXcalidraw, and then I'm not happy with the image, I make a change, because the change affects the aspect ratio of the image, and then I save.

When I open EXcalidraw, I see a distorted image. Images in EXcalidraw still have the same aspect ratio, resulting in images that look squashed.

I want EXcalidraw to display my images as normal as it does in markdown

When using EXcalidraw to link local images, I had to spend time re-linking and pasting once I had scaled the images. Even the most recent time I modified a large number of pictures, re-gluing pictures in bulk to maintain the correct aspect ratio. Seems like a disaster to me.

I do not think it is the function of EXcalidraw to modify the aspect ratio of images, as with any note-taking software, EXcalidraw should prioritize images to be displayed in the correct aspect ratio.

If I can maintain my images with the right aspect ratio like markdown, I would really appreciate it

zsviczian commented 4 months ago

Because you can also manually distort images within Excalidraw (shift resize), when you change an image outside Excalidraw and then open Excalidraw the next time, Excalidraw will have no information to decide if the difference in aspect ratio, the one stored in the image element's height and width parameter vs. the actual aspect ratio of the image that you have manually changed is deliberate or not. Thus if you change the image outside Exclidraw the image will become distorted. Writing a script that automatically corrects the aspect ratios of images to match the aspect ratio of the image is not very hard. I recommend that you give it a try.

zsviczian commented 4 months ago

fixed in 2.2.3 https://github.com/excalidraw/excalidraw/pull/8061