<div dir="ltr"><div>I don&#39;t think so, my package org-link-beautify ported to the new<br>:preview mechanism. The file preview not always image. Could be text, or<br>icon etc. So pass in image object is not a good idea. It will limit<br>preview functionality extensibility.</div><div><br></div><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr">[stardiviner]           &lt;Hack this world!&gt;      GPG key ID: 47C32433<br>IRC(freeenode): stardiviner                     Twitter:  @numbchild<br>Key fingerprint = 9BAA 92BC CDDD B9EF 3B36  CB99 B8C4 B8E5 47C3 2433<br>Blog: <a href="http://stardiviner.github.io/" target="_blank">http://stardiviner.github.io/</a><br></div></div></div></div></div><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Tue, Dec 17, 2024 at 11:43 AM Karthik Chikmagalur &lt;<a href="mailto:karthikchikmagalur@gmail.com">karthikchikmagalur@gmail.com</a>&gt; wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">&gt;&gt; Would it be possible to also handle image data in the function or<br>
&gt;&gt; refactor the org-link-preview-file function in a way that the geometry<br>
&gt;&gt; handling is done in a helper function which can be reused by other<br>
&gt;&gt; handlers.<br>
&gt;<br>
&gt; There is such function: `org-display-inline-image--width&#39;.<br>
&gt; We may consider exposing it as public function.<br>
<br>
This will not be enough, we will also have to expose `org-image--align&#39;<br>
and the alignment code:<br>
<br>
(when align<br>
  (overlay-put<br>
   ov &#39;before-string<br>
   (propertize<br>
    &quot; &quot; &#39;face &#39;default<br>
    &#39;display<br>
    (pcase align<br>
      (&quot;center&quot; `(space :align-to (- center (0.5 . ,image))))<br>
      (&quot;right&quot;  `(space :align-to (- right ,image)))))))<br>
<br>
I don&#39;t think we can expect third party packages to figure out and<br>
reimplement Org&#39;s image alignment logic.<br>
<br>
Considering this, it might be better to just split<br>
`org-link-preview-file&#39; into two public functions, where the &quot;inside&quot;<br>
function accepts an image instead of a file.<br>
<br>
Karthik<br>
<br>
</blockquote></div>