typst/tests/typ/elements/image.typ
Laurenz b69c0355ec Don't fit images to remaining height
Makes them really small if there's only little space left ...
2021-10-05 20:05:15 +02:00

41 lines
889 B
XML

// Test the `image` function.
---
// Test loading different image formats.
// Load an RGBA PNG image.
#image("../../res/rhino.png")
#pagebreak()
// Load an RGB JPEG image.
#image("../../res/tiger.jpg")
---
// Test configuring the size and fitting behaviour of images.
// Set width explicitly.
#image("../../res/rhino.png", width: 50pt)
// Set height explicitly.
#image("../../res/rhino.png", height: 50pt)
// Set width and height explicitly and force stretching.
#image("../../res/rhino.png", width: 25pt, height: 50pt)
// Make sure the bounding-box of the image is correct.
#align(bottom, right)
#image("../../res/tiger.jpg", width: 60pt)
---
// Does not fit to height of page.
#page(height: 60pt)
#image("../../res/rhino.png")
---
// Error: 8-29 file not found
#image("path/does/not/exist")
---
// Error: 8-21 failed to load image (unknown image format)
#image("./image.typ")