emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SVG with embedded png


From: Joe Corneli
Subject: Re: SVG with embedded png
Date: Wed, 19 May 2021 13:57:23 +0100

Alan Third writes:

> More than likely the problem is that the image file isn't within the
> SVG file's sub-tree. Librsvg won't load URLs that aren't in the same
> directory as the SVG file or in a subdirectory.
>
> This is why people grabbing the two files and dumping them in the same
> directory see the image, but if you put the png in /tmp it doesn't.
>
> This is a security feature, apparently.

Thanks Alan!

I can confirm that the following snippet works fully as expected
(assuming that the image placed in the location indicated), via M-x
org-toggle-latex-fragment:

$$\begin{tabular}{cc} 
\includegraphics[width=4cm,natwidth=445,natheight=661]{/home/joe/ltximg/Tft1st.png}
 & 
\includegraphics[width=4cm,natwidth=445,natheight=661]{/home/joe/ltximg/Tft1st.png}\end{tabular}$$

8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<

THE BACKSTORY

Gregor had written to me separately to ask what I wanted to achieve by
putting the PNG within the SVG, so I thought I would just to explain
what I was getting at, for completeness.

My goal was to get two images next to each other (which not directly
possible using standard Org mode markup).

I learned that it is possible to get an image and text side-by-side with
a suitable LaTeX fragment (https://emacs.stackexchange.com/a/50633/8406)

That made me wonder if I could get two images side-by-side using a
similar LaTeX trick.  (I don’t have any specific need to embed
everything in SVG, that’s just my usual setting for LaTeX fragments.)
When I noticed the missing image, I thought I had found a bug.

...Now it turns out it wasn’t a bug, but a security feature!

(Aside: I should have posted to the ‘bugs’ list, but it has been a while
since I submitted a bug report so I forgot all about that!)

On reflection: could the strange niche case I found actually motivate
any code or documentation changes in Org?  It seems unlikely, but maybe
there’s something here.  Maybe others have an opinion now that they’ve
seen the story has been presented in full.

> Actually, it does if you use the right option:
>
> (insert-image (create-image "/wherever/your/image/is/Tft.svg" 'svg nil
> :base-uri "/tmp"))


-- 
Dr Joseph A. Corneli (https://github.com/holtzermann17)

HYPERREAL ENTERPRISES LTD is a private company limited by shares, incorporated
25th, June 2019 as Company Number 634284 on the Register of Companies for
Scotland (https://beta.companieshouse.gov.uk/company/SC634284).



reply via email to

[Prev in Thread] Current Thread [Next in Thread]