p

piclabeler

@preview

Annotate images with labels and arrows.

v0.1.0
MIT

Package Information

Last Updated
Minimum Typst Version
0.14.0
Categories
visualization

1. Get the package

Download the package using the TPIX CLI:

tpix get @preview/piclabeler:0.1.0

2. Import in your Typst file

Add this to your .typ file:

#import "@preview/piclabeler:0.1.0": *

Version History

0.1.00.14.0
4e3abd0de60c...

Piclabeler

Typst package to annotate images with labels and arrows.

Piclabeler uses the Typst drawing library CeTZ to place an image on a canvas with a guiding grid and provides functions to annotate it.
It is similar to the LaTeX packages overpic or tikz-imagelabels.

Example

The following code creates an annotated image with two labels:

#import "@preview/piclabeler:0.1.0" as pl

#pl.annotated-image(
  width: 10cm,
  image-width: 80%,
  // https://images.nasa.gov/details/B1B_Cargo_Expanded_View
  image("B1B_Cargo_Expanded_View.jpg"),
  {
    let label = pl.label.with(
      frame: "rect",
      padding: 0.4em,
      mark: (
        end: ">>",
        fill: black,
        stroke: none
      ),
    )
    label([Cargo Fairing], (6, 0), to: (6, 4.3))
    label([Boosters], (2, -2), to: ((-4.6, 1), (-2, -4.7)))
  },
)

Example annotation with the grid

After placing the labels and arrows, the grid can be disabled by setting grid: none:

#pl.annotated-image(
    grid: none,
    // ...
)

Example annotation without the grid