Pixels are not a good unit for different screen sizes or even PDF printing, it would be preferable to be able to use relative units like %, em and rem.
Proposed solution
Add the possibility to specify %, em and rem as relative units, instead of just pixels. Maybe like so:
Since many of us are surely using Pandoc for post-processing Obsidian Notes into papers or books, it would even be better to (also?) support the Pandoc link_attributes notation:
Commenting to +1 this. Especially useful for viewing my notes on mobile. Currently, my larger images that look fine on desktop are cut off the screen on mobile.
This is a particularly pertinent issue now, since Pandoc 3.1.7 just added support for Wikilink images. However, Pandoc doesn’t recognize image attributes combined with wikilinks, since Obsidian and other apps using wikilinks don’t support the image attribute syntax.
I am reluctant to support a syntax that nobody supports. I don’t think you can provide such attributes on, e.g., GitHub wiki or Obsidian…
And my response:
I’m not entirely sure which syntax you are referring to. If it’s the wikilink image syntax, then didn’t you just add support for that?
If it’s the {width=50%} image size syntax, then my question is, isn’t that the default Pandoc image sizing/attribute syntax?
Or perhaps it’s the combination that you are reluctant about? If so, can you clarify why? If you support wikilink images, there should be some way to specify their size too, don’t you think?
And his response:
I meant the combination.
We could support it. But the point of the wikilinks extension was to allow interoperability with specific platforms that support this syntax, and they don’t support the use of image attributes with it…
Therefore, to ensure better compatibility with Pandoc, I second the need to either support Pandoc’s image attribute syntax, or to establish a more robust image resizing syntax with unit support that Pandoc could recognize. Preferably both.
Feel free to contribute on the Github issue above, and indicate your interest / support.
Yesterday I resized a bunch of images on desktop and in mobile they extend beyond the screen. It seems the pixel resizing as a hard limit doesn’t work well cross platform.
A percentage that works relative to the screen would be much better.
A must-have feature for Obsidian Publish - I want all viewers of my page to experience the same size of the image, regardless of their screen DPI. That’s why we need relative units like em or rem.
Just wanted to add my +1 to this. I want to use custom images similar to how you would custom emotes, and it would be nice if they would adapt to changing font sizes like headings
My workaround for these kind of issue is to create a css snippet for iPhone only, and then force image to display in certain width, overriding width param.
As someone who uses desktop and mobile there is no way to dynamically adapt image size without full scale (that is using a gigantic size so it caps on screen width)