ToolLineup

Code to Image

Paste a snippet and get a picture of it, ready for a slide, a README or a social post. Five themes, a window bar with an optional title, line numbers, a gradient backdrop and a resolution control up to 3× are all adjustable, and the language is detected automatically or chosen by hand from ten options. The highlighter recognises comments, strings, numbers and keywords, so an incomplete fragment renders fine. Everything happens in your browser.

0 lines
Preview

Paste some code above and the picture appears here.

The highlighting recognises comments, strings, numbers and keywords rather than fully parsing the language, so an incomplete fragment renders fine — but a rare construct may be coloured as plain text.

Frequently asked questions

Which languages are supported?

Ten groups cover most of what people share: JavaScript and TypeScript, Python, Java, C# and C++, Go and Rust, SQL, shell, CSS, JSON, HTML and XML, plus plain text. The language is guessed from the snippet unless you pick one.

Why is some code not coloured the way my editor shows it?

The highlighter is a scanner rather than a full parser — it recognises comments, strings, numbers and keywords. That is what lets it handle an incomplete fragment without failing, but a rare construct may come out as plain text.

What resolution should I choose?

Use 2× for anything shown on a modern screen, since it stays sharp on high-density displays. 3× is worth it only for print or if the image will be cropped and enlarged; 1× keeps the file smallest.

Can I copy the picture straight into another app?

The Copy image button writes a PNG to the system clipboard, which most apps will paste directly. Some browsers block that for security reasons, in which case the Download button always works.

Are tabs handled correctly?

Tabs are expanded to the number of spaces you set before rendering, because a canvas draws a tab character as nothing at all, which would silently collapse your indentation.

Related tools