image
元素元素元素函数可用set
和show
规则自定义样式。
set
和show
规则自定义样式。A raster or vector graphic.
Supported formats are PNG, JPEG, GIF and SVG.
Note: Work on SVG export is ongoing and there might be visual inaccuracies in the resulting PDF. Make sure to double-check embedded SVG images. If you have an issue, also feel free to report it on GitHub.
Example
#figure(
image("molecular.jpg", width: 80%),
caption: [
A step in the molecular testing
pipeline of our lab.
],
)

参数参数参数是传给函数的输入,写在函数名后的括号中。
path
Path to an image file.
format
The image's format. Detected automatically by default.
默认值: auto
可填写的值
png
Raster format for illustrations and transparent graphics.
jpg
Lossy raster format suitable for photos.
gif
Raster format that is typically used for short animated clips.
svg
The vector graphics format of the web.
fit
可用set规则可用set规则可用set
规则设置参数,更改后续调用时的默认值。
set
规则设置参数,更改后续调用时的默认值。How the image should adjust itself to a given area.
默认值: "cover"
可填写的值
cover
The image should completely cover the area. This is the default.
contain
The image should be fully contained in the area.
stretch
The image should be stretched so that it exactly fills the area, even if this means that the image will be distorted.
定义定义这些函数和类型带有附属定义。要访问这种定义,请先写上函数或类型的名称,再加上定义的名称,并用句点在中间分隔。
decode
Decode a raster or vector graphic from bytes or a string.
展开例子
#let original = read("diagram.svg")
#let changed = original.replace(
"#2B80FF", // blue
green.to-hex(),
)
#image.decode(original)
#image.decode(changed)

data
The data to decode as an image. Can be a string for SVGs.
format
The image's format. Detected automatically by default.
可填写的值
png
Raster format for illustrations and transparent graphics.
jpg
Lossy raster format suitable for photos.
gif
Raster format that is typically used for short animated clips.
svg
The vector graphics format of the web.
fit
How the image should adjust itself to a given area.
可填写的值
cover
The image should completely cover the area. This is the default.
contain
The image should be fully contained in the area.
stretch
The image should be stretched so that it exactly fills the area, even if this means that the image will be distorted.