I have an image with a fixed height and width, however I dont always know what the actual dimensions of logo.png are going to be. Sometimes the logo is smaller than those dimensions.
image(
"images/logo.png",
height: 3cm,
width: 6cm,
alt: none,
fit: "contain",
)
My problem is, in case the logo.png is smaller, the image is always centered inside the image block and I can’t get it right aligned. Is there something I am missing? Or is there a workaround?
I tried omitting either height or width, but some logos are either too tall or too wide, so I have to set both as a maximum.
UPDATE: I think I got want I needed when putting the image in a box and setting the width and height of that box instead. Wrapping the box with align(right, …) seems to do the trick.
align(alignment.right + alignment.horizon, box(height: 3cm, width: 6cm, image("images/logo.png", alt: none, fit: "contain")))