How to get size of image when using ratio scaling?

In the following code, the measurement of the image is reported to be (width: 0pt, height: 0pt) when using ratios for sizes. I can understand why, as the variable k might be reused in a different context where it could be a different size. How can I get the size of one use of the image? I’ve tried using labels, moving around where context is used, and trying things with additional variables inside context, all to no avail.

#let k = image("1.png", width: 100%)

#context [
  #k
  #measure(k)
]

Measure Function – Typst Documentation :

By default an infinite space is assumed, so the measured dimensions may not necessarily match the final dimensions of the content. If you want to measure in the current layout dimensions, you can combine measure and layout.

#layout(size => measure(k, ..size))
1 Like

Yet another instance of me not reading the docs close enough

1 Like