Images Reference

Document attributes and values
Attribute Value(s) Example Syntax Comments

imagesdir

empty, filesystem path, or base URL

:imagesdir: images

Added in front of a relative image target, joined using a file separator if needed. Not used if the image target is an absolute URL or path. Default value is empty.

Block and inline image attributes and values
Attribute Value(s) Example Syntax Comments

id

User defined text

id=sunset-img
(or [[sunset-img]] or [#sunset-img] above block macro)

alt

User defined text in first position of attribute list or named attribute

image::sunset.jpg[Brilliant sunset]
(or alt=Sunset)

fallback

Image path relative to imagesdir or an absolute path or URL

image::tiger.svg[fallback=tiger.png]

Only applicable if target is an SVG and opts=interactive

title

User defined text

title="A mountain sunset"
(or .A mountain sunset above block macro)

Blocks: title displayed below image; Inline: title displayed as tooltip

format

The format of the image, specified as a sub-MIME type (except in the case of an SVG, which is specified as svg).

format=svg

Only necessary when the converter needs to know the format of the image and the target does not end in a file extension (or otherwise cannot be detected).

caption

User defined text

caption="Figure 8: "

Only applies to block images.

width

User defined size in pixels

image::sunset.jpg[Sunset,300]
(or width=300)

height

User defined size in pixels

image::sunset.jpg[Sunset,300,200]
(or height=200)

The height should only be set if the width attribute is set and must respect the aspect ratio of the image.

link

User defined location of external URI

link=https://www.flickr.com/photos/javh/5448336655

window

User defined window target for the link attribute

window=_blank

scale

A scaling factor to apply to the intrinsic image dimensions

scale=80

DocBook only

scaledwidth

User defined width for block images

scaledwidth=25%

DocBook and Asciidoctor PDF only

pdfwidth

User defined width for images in a PDF

pdfwidth=80vw

Asciidoctor PDF only

align

left, center, right

align=left

Block images only. align and float attributes are mutually exclusive.

float

left, right

float=right

Block images only. float and align attributes are mutually exclusive. To scope the float, use a float group.

role

user-defined, left, right, th, thumb, related, rel

role="thumb right"
(or [.thumb.right] above block macro)

The role is preferred to specify the float position for an image. Role shorthand (.) can only be used in block attribute list above a block image.

opts

Additional options for link creation and SVG targets.

image::sunset.jpg[Sunset, link=https://example.org, opts=nofollow]

image::chart.svg[opts=inline]

Option names include: nofollow, noopener, inline (SVG only), interactive (SVG only)