Why a picture of code at all
Nowhere that matters for sharing renders a code block: a slide, a social post, a chat with a client. A picture keeps the indentation and the colour, which is most of what makes code readable at a glance.
For the places that flatten a code block into unreadable plain text - slides, social posts, a message to a client. The picture is drawn in this tab at twice the resolution, so it stays sharp on a retina screen, and the snippet is never uploaded to anyone.
863 × 510 points, exported at twice that.
Copying an image to the clipboard is allowed in Chrome and Edge; Firefox and Safari restrict it, so use Download there.
Nowhere that matters for sharing renders a code block: a slide, a social post, a chat with a client. A picture keeps the indentation and the colour, which is most of what makes code readable at a glance.
A picture cannot be copied, searched, translated or read by a screen reader. Use it to show code, never to deliver it - if the reader needs to run the snippet, give them the text as well.
The highlighter here marks strings, comments, numbers and keywords - the four that carry almost all of the visual information. A full grammar per language would be a megabyte of parser for a picture, which is not a trade worth making in a browser tab.