How to specify the DPI while saving a Makie figure?

For example, how can I obtain a figure with a physical size of (3.25 in x 2.4 in)?

If you save as a bitmap, multiply your size in inches by your desired dpi to get the resolution in pixels. Then save with px_per_unit = 1 (that is the default anyway but can be changed).

If you save as a pdf or svg using CairoMakie, calculate how many pt correspond to the width in inches you want and set that, then save with the keyword argument pt_per_unit = 1 (the default is 0.75 to match bitmap sizes in web contexts because 1px == 0.75pt).

1in == 72pt, so for your desired size do:

f = Figure(resolution = (3.25, 2.4) .* 72)
save("figure.pdf", pt_per_unit = 1)

(Maybe you need to round the resolution to Int)