How are image links generated?

Since it’s a custom URL scheme, that kind of link will only work in a Discourse instance. Plus, if you want the link to actually work, it’ll need to be a link to an image on the same instance.

Why would you want to know? In Discourse, there are the “original” and a bunch of thumbnails (what we call optimized) which are mostly generated to support different pixel ratios.