`background-img`, metropolis
Nice to see this!
A few questions/issues on background images:
Absolute file paths?
I'm new to typst, so not sure if I'm just misunderstanding, but it appears I can only use relative paths for images? Is that necessary?
❯ typst compile slides.typ
error: file not found (searched at /home/bruce/Code/typst-examples/~/Pictures/student-map-example.png)
┌─ /slides.typ:41:35
│
41 │ #focus-slide(background-img: image("~/Pictures/student-map-example.png"))[
│ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
background-img and metropolis?
Using metropolis, if I copy the image to the directory, it then compiles, but I don't see any image. Is background-img just not supported in metropolis? If that's the case, could you add it?
only in focus-slide?
Also, is it only available on focus-slide? I'd like to be able to use it more broadly.
nice to have
Finally, in the "nice to have" category:
I use background images a lot. Ideally it would be possible to modify their rendering; for example, to darken them, or add transparency, so that the text on top of them can be adjusted to be better legible.
Nice to see this!
Thank you!
A few questions/issues on background images:
Absolute file paths?
I'm new to typst, so not sure if I'm just misunderstanding, but it appears I can only use relative paths for images? Is that necessary?
❯ typst compile slides.typ error: file not found (searched at /home/bruce/Code/typst-examples/~/Pictures/student-map-example.png) ┌─ /slides.typ:41:35 │ 41 │ #focus-slide(background-img: image("~/Pictures/student-map-example.png"))[ │ ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Please see the v0.6.0 changelog: https://typst.app/docs/changelog/
It disallows paths outside of the current project's root (--root CLI argument), absoute paths never worked for security reasons.
background-img and metropolis?
Using
metropolis, if I copy the image to the directory, it then compiles, but I don't see any image. Isbackground-imgjust not supported inmetropolis? If that's the case, could you add it?
Can you show the code that compiled? But no, the metropolis theme only supports what is said on the documentation page. I'd be hesitant to add background image support to that specific theme because I don't think it fits the minimalist nature of the original beamer theme. I could think about making it more easy to add background images in general.
only in focus-slide?
Also, is it only available on
focus-slide? I'd like to be able to use it more broadly.nice to have
Finally, in the "nice to have" category:
I use background images a lot. Ideally it would be possible to modify their rendering; for example, to darken them, or add transparency, so that the text on top of them can be adjusted to be better legible.
That seems to be out of scope for this package and probably even for Typst itself. It's not an image editing software, after all. In any case, you should open an issue in the Typst repository if you want to see this supported.
I'd be hesitant to add background image support to that specific theme because I don't think it fits the minimalist nature of the original beamer theme.
But one can place background images in that theme, even if not that easy/straightforward.
I could think about making it more easy to add background images in general.
That would be nice.
Can you show the code that compiled?
Hmm ... trying it just now it doesn't compile, which is what I would expect.
❯ typst compile slides.typ
error: unexpected argument: background-img
┌─ /slides.typ:41:13
│
41 │ #focus-slide(background-img: image("example.png"))[
│
That seems to be out of scope for this package and probably even for Typst itself. It's not an image editing software, after all. In any case, you should open an issue in the Typst repository if you want to see this supported.
Had a chance back-and-forth on this with the typst folks. They're planning to support both transparency and brightness/darkness modification on images.
https://mastodon.social/@typst/110855816142602402
Oh that's good news then, nice!