{"category":"generate","description":"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.","endpoint":"https://setget.net/v1/tools/code-image","examples":[{"input":{"code":"def greet(name):\n    return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))","language":"python","title":"greet.py"},"title":"Python in a dark window"},{"input":{"code":"SELECT name, COUNT(*) AS orders\nFROM customers\nJOIN orders USING (customer_id)\nGROUP BY name\nORDER BY orders DESC\nLIMIT 10;","line_numbers":true,"padding":0,"scale":1,"theme":"light","window":false},"title":"SQL with line numbers, light theme, no border"},{"input":{"background":"#bd93f9","code":"const total = items\n  .filter((item) => item.inStock)\n  .reduce((sum, item) => sum + item.price, 0);","format":"webp","theme":"dracula"},"title":"Detected JavaScript as WebP"}],"input_schema":{"additionalProperties":false,"properties":{"background":{"default":"#abb8c3","description":"Colour of the border: hex such as #abb8c3, a basic colour name, or \"transparent\".","type":"string"},"code":{"description":"The source code to draw. Up to 200 lines.","examples":["def greet(name):\n    return f\"Hello, {name}!\"\n\nprint(greet(\"world\"))"],"maxLength":20000,"type":"string"},"font_size":{"default":16,"description":"Text size in pixels, before scaling.","maximum":40,"minimum":8,"type":"integer"},"format":{"default":"png","description":"Picture format.","enum":["png","webp","jpg"],"type":"string"},"language":{"default":"auto","description":"The language, such as python, javascript, sql or bash. \"auto\" detects common languages; \"text\" turns colouring off.","examples":["python"],"maxLength":40,"type":"string"},"line_numbers":{"default":false,"description":"Show line numbers on the left.","type":"boolean"},"padding":{"default":32,"description":"Width of the coloured border around the window, in pixels. 0 removes the border.","maximum":128,"minimum":0,"type":"integer"},"scale":{"default":2,"description":"Pixel density: 2 gives a sharp picture for high-resolution screens, 1 a smaller file.","maximum":2,"minimum":1,"type":"integer"},"theme":{"default":"one-dark","description":"Colour theme. The first six are dark, the last four are light.","enum":["one-dark","dracula","monokai","nord","github-dark","solarized-dark","light","solarized-light","gruvbox-light","xcode"],"type":"string"},"title":{"description":"Text for the title bar, such as a file name.","examples":["greet.py"],"maxLength":80,"type":"string"},"window":{"default":true,"description":"Show a title bar with three window buttons.","type":"boolean"},"wrap":{"default":100,"description":"Lines longer than this many characters continue on the next row.","maximum":200,"minimum":40,"type":"integer"}},"required":["code"],"type":"object"},"keywords":["code screenshot","code to image","code snippet image","carbon","ray.so","syntax highlighting","code picture","source code png","share code","code snapshot","pretty code"],"related":["table-image","og-card","chart","image-convert","image-resize"],"slug":"code-image","summary":"Turn source code into a shareable picture with syntax highlighting, a window frame and a choice of themes.","tier":"job","timeout_seconds":60,"title":"Code to image","url":"https://setget.net/tools/code-image"}
