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.
],
)

参数参数参数是传给函数的输入,写在函数名后的括号中。
image(,,,,alt:,fit:)->path
pathPath to an image file.
The image's format. Detected automatically by default.
可填写的值
pngRaster format for illustrations and transparent graphics.
jpgLossy raster format suitable for photos.
gifRaster format that is typically used for short animated clips.
svgThe vector graphics format of the web.
默认值:auto
fit可用set规则可用set规则可用set规则设置参数,更改后续调用时的默认值。
fitset规则设置参数,更改后续调用时的默认值。How the image should adjust itself to a given area.
可填写的值
coverThe image should completely cover the area. This is the default.
containThe image should be fully contained in the area.
stretchThe image should be stretched so that it exactly fills the area, even if this means that the image will be distorted.
默认值:"cover"
定义定义这些函数和类型带有附属定义。要访问这种定义,请先写上函数或类型的名称,再加上定义的名称,并用句点在中间分隔。
decode
decodeDecode 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)

image.decode(,,,,alt:,fit:)->The data to decode as an image. Can be a string for SVGs.
The image's format. Detected automatically by default.
可填写的值
pngRaster format for illustrations and transparent graphics.
jpgLossy raster format suitable for photos.
gifRaster format that is typically used for short animated clips.
svgThe vector graphics format of the web.
fit
fitHow the image should adjust itself to a given area.
可填写的值
coverThe image should completely cover the area. This is the default.
containThe image should be fully contained in the area.
stretchThe image should be stretched so that it exactly fills the area, even if this means that the image will be distorted.