How can I use function 'measure' inside 'grid' to align two images?

Hello,
I would like to place two images side by side using the grid function, ensuring that the height of the right image is the same as the height of the left image. To do this, I’ve tried using the measure function (new in Typst 0.12) within the grid function, but without success. Could you tell me if this is possible, and how?
Thanks! (the code I’ve tried just below)

#grid(
  columns: (1fr, 1fr),
  rows: (auto),
  gutter: 0.2in,
  
  image("image1.jpg"),
  image("image2.jpg", height: context measure(image("image1.jpg")).height)
)

 

error: expected auto, relative length, or fraction, found content

It looks like this is your problem:

In short, you need to pull context out of the image function:

  context image("image2.jpg", height: measure(image("image1.jpg")).height)
1 Like