"How do I do this ... I got the impression that dpi is for monitors, not image formats."
DPI stands for dots per inch. What does this have to do with monitors? Well, we have a pixel of three RGB subpixels. The higher the DPI, the more detail you squeeze into this space.
DPI is a useful measurement for displays and prints, but nothing useful ... in fact, nothing for the image formats themselves.
The reason that DPI is labeled inside some formats is to instruct devices to display with this resolution, but from what I understand, almost everyone ignores this instruction and does everything possible to optimize the image for a specific result.
You can change 72 dpi to 1 dpi or 6000 dpi in the image format, and this will not affect the monitor. "Upsize / downsize to 300 dpi" does not make sense. Re-sampling also does not change the DPI. Try it in Photoshop, uncheck "Resample" when changing DPI, and you will not see any difference. He will NOT be more or less.
DPI is absolutely pointless for image formats, IMO.
source share