Skip to main content
Images anchor to a rectangle of cells. Give a path or raw bytes, plus the corners.
Image coordinates are 0-based on both axes, unlike cell styles and tables where rows are 1-based.

From a file

str
required
Path to the image on disk.
int
required
0-based left column.
int
required
0-based top row.
int
required
0-based right column.
int
required
0-based bottom row.

From bytes

Use this when the image never touches disk, whether downloaded, read from a database, or generated in the same script.
bytes
required
Raw image bytes.
str
required
Format, such as "png". Required, since there’s no filename to infer from.
This is the practical route to chart types Jetxl doesn’t offer natively. Render it with matplotlib or plotly and embed the PNG. The trade-off is that the result is a picture, so it won’t update when the underlying cells change the way a native chart does.

Formats

Sizing

The rectangle you give determines the displayed size, so aspect ratio is yours to manage. A wide anchor around a square logo stretches it.
Roughly 2 to 4 columns by 5 to 8 rows.
Roughly 4 to 6 columns by 8 to 12 rows.
Roughly 6 to 10 columns by 12 to 20 rows.
Jetxl embeds images whole. A handful of multi-megabyte photographs produces a workbook that’s slow to open and awkward to email, so resize before embedding.