Code to image
Turn source code into a shareable picture with syntax highlighting, a window frame and a choice of themes. Colours the code by language, then draws it in a monospaced font inside a rounded window with a soft shadow. Nothing is loaded from outside: the code you send is the only input.
Input
Result
Choose a file and press Run.
Files you upload and the results are stored for one hour, then deleted. Anyone who has the link can open them, so don't upload anything private.
Use it from code or an agent
curl -s https://setget.net/v1/tools/code-image \
-H 'Content-Type: application/json' \
-d '{"input":{"code":"def greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))","language":"python","title":"greet.py"},"wait":30}'
import json, urllib.request
body = {'input': {'code': 'def greet(name):\n return f"Hello, {name}!"\n\nprint(greet("world"))', 'language': 'python', 'title': 'greet.py'}, 'wait': 30}
request = urllib.request.Request("https://setget.net/v1/tools/code-image", json.dumps(body).encode(),
{"Content-Type": "application/json"})
print(json.load(urllib.request.urlopen(request))["result"])
const response = await fetch("https://setget.net/v1/tools/code-image", {
method: "POST",
headers: {"Content-Type": "application/json"},
body: JSON.stringify({"input":{"code":"def greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))","language":"python","title":"greet.py"},"wait":30}),
});
console.log((await response.json()).result);
Tool: run_tool
Arguments:
{
"slug": "code-image",
"input": {
"code": "def greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))",
"language": "python",
"title": "greet.py"
},
"wait": 30
}
{
"input": {
"code": "def greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))",
"language": "python",
"title": "greet.py"
},
"wait": 30
}
This is a file tool, so a call takes three steps: upload the file to get a reference, run the tool with that reference, then read the result and download its files. Uploads and results are public by link and expire after one hour.
Endpoint: POST /v1/tools/code-image. Over MCP: run_tool with slug: "code-image".
Machine-readable: input schema, Markdown. Connect an agent.
Inputs
| Name | Type | Required | What it does |
|---|---|---|---|
code |
string | yes | The source code to draw. Up to 200 lines. |
language |
string | no | The language, such as python, javascript, sql or bash. "auto" detects common languages; "text" turns colouring off. Default: "auto". |
theme |
string | no | Colour theme. The first six are dark, the last four are light. One of: one-dark, dracula, monokai, nord, github-dark, solarized-dark, light, solarized-light, gruvbox-light, xcode. Default: "one-dark". |
font_size |
integer | no | Text size in pixels, before scaling. Default: 16. From 8 to 40. |
padding |
integer | no | Width of the coloured border around the window, in pixels. 0 removes the border. Default: 32. From 0 to 128. |
background |
string | no | Colour of the border: hex such as #abb8c3, a basic colour name, or "transparent". Default: "#abb8c3". |
line_numbers |
boolean | no | Show line numbers on the left. Default: false. |
window |
boolean | no | Show a title bar with three window buttons. Default: true. |
title |
string | no | Text for the title bar, such as a file name. |
wrap |
integer | no | Lines longer than this many characters continue on the next row. Default: 100. From 40 to 200. |
scale |
integer | no | Pixel density: 2 gives a sharp picture for high-resolution screens, 1 a smaller file. Default: 2. From 1 to 2. |
format |
string | no | Picture format. One of: png, webp, jpg. Default: "png". |
Examples
Python in a dark window
{
"code": "def greet(name):\n return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))",
"language": "python",
"title": "greet.py"
}Press the example button above to make it.
SQL with line numbers, light theme, no border
{
"code": "SELECT name, COUNT(*) AS orders\nFROM customers\nJOIN orders USING (customer_id)\nGROUP BY name\nORDER BY orders DESC\nLIMIT 10;",
"theme": "light",
"line_numbers": true,
"window": false,
"padding": 0,
"scale": 1
}Press the example button above to make it.
Detected JavaScript as WebP
{
"code": "const total = items\n .filter((item) => item.inStock)\n .reduce((sum, item) => sum + item.price, 0);",
"theme": "dracula",
"background": "#bd93f9",
"format": "webp"
}Press the example button above to make it.
Questions
- Which languages are supported?
- Several hundred, including Python, JavaScript, TypeScript, HTML, CSS, SQL, Bash, Go, Rust, Java, C, C++, C#, PHP, Ruby, YAML, JSON and Markdown. Auto-detection covers the common ones; name the language for anything else.
- What happens to long lines and tabs?
- Tabs become four spaces. Lines longer than the "wrap" setting continue on the next row, and with line numbers on, the continued row has no number.
- What are the limits?
- Up to 20,000 characters and 200 lines. For longer files, share the part that matters.
- Why is the picture twice as large as I expected?
- Scale 2 doubles the pixels so the text stays sharp on phones and high-resolution screens. Choose scale 1 for the plain size.
Related tools
- Table image generatorRender a small table as a tidy SVG image with a header row, zebra stripes and right-aligned numbers.
table-image - Social preview card generatorMake a 1200×630 social preview (Open Graph) card as SVG with a wrapped title, subtitle and site name.
og-card - Chart generatorMake a clean SVG bar, line, area, pie or donut chart from labels and values, with axes, legend and title.
chart - Convert image formatConvert an image between PNG, JPG, WebP, AVIF, GIF, BMP, TIFF and ICO. Animated GIF and WebP stay animated.
image-convert - Resize imageResize an image to a width, a height or both, keeping its proportions, cropping to fill, or stretching.
image-resize - .gitignore generatorBuild a .gitignore for the languages, editors and operating systems you use, merged without duplicates.
gitignore-generate