Output: PNG, SVG and Files
output
Choose the image format, get it back as base64 or SVG text, or write files directly — including numbered file sets for structured append. Optionally include the module bit-matrix and a reusable definition.
The output object
Format, return channel, destinations
| Member | Values | Default | Notes |
|---|---|---|---|
output.format | "png" · "svg" | "png" | |
output.return | "base64" · "text" · "none" | "base64" | text is for textual formats (SVG) only; none requires a file destination. |
output.path | file path | — | Write the single output to this file. With a structured-append set of more than one symbol this is conflictingOptions. |
output.pathTemplate | file path containing {index} | — | Write every output to a numbered file; {index} is replaced by 1, 2, 3, … Mutually exclusive with path. |
output.overwrite | bool | false | When false, an existing destination fails the request with outputFailed before anything is written. |
output.includeModuleData | bool | false | Adds symbols[i].moduleData (the module bit-matrix). |
output.includeDefinition | bool | false | Adds a top-level definition: a reusable request fragment. |
Each delivered image is described by an outputs[] entry (one per symbol, in order):
| Member | Meaning |
|---|---|
index | 0-based position; matches symbols[index] and measurements[index]. |
formatmimeType | png / image/png or svg / image/svg+xml. |
widthheight | Canvas size in pixels (after rotation). |
unitsphysicalWidthphysicalHeight | The physical size when render.units is mm, in or pt. |
byteCount | Size of the image in bytes. |
base64 | The image bytes, base64-encoded (return: "base64"). |
text | The SVG document (return: "text"). |
path | The file written (when path or pathTemplate was given). |
PNG
The default format
PNG output is a standard 8-bit image: grayscale when both paints are neutral and opaque, RGB when the background is opaque, RGBA when the background is translucent or transparent. The render.dpi value is recorded in the file (pHYs chunk) so printers and image tools know the intended physical size.
Chilkat.JsonObject jsonIn = new Chilkat.JsonObject();
jsonIn.UpdateString("payload.text", "https://www.chilkatsoft.com");
jsonIn.UpdateString("output.format", "png"); // the default
jsonIn.UpdateString("output.return", "base64"); // the default
Chilkat.JsonObject jsonOut = new Chilkat.JsonObject();
Chilkat.Formats fmt = new Chilkat.Formats();
if (!fmt.QrCode("generate", jsonIn, jsonOut)) { Console.WriteLine(fmt.LastErrorText); return; }
Chilkat.BinData png = new Chilkat.BinData();
png.AppendEncoded(jsonOut.StringOf("outputs[0].base64"), "base64");
// png.GetBytes() for an in-memory image, or:
png.WriteFile("qr.png");CkJsonObject jsonIn;
jsonIn.UpdateString("payload.text", "https://www.chilkatsoft.com");
jsonIn.UpdateString("output.format", "png"); // the default
jsonIn.UpdateString("output.return", "base64"); // the default
CkJsonObject jsonOut;
CkFormats fmt;
if (!fmt.QrCode("generate", jsonIn, jsonOut)) { std::cout << fmt.lastErrorText() << "\r\n"; return; }
CkBinData png;
png.AppendEncoded(jsonOut.stringOf("outputs[0].base64"), "base64");
png.WriteFile("qr.png");jsonIn = chilkat2.JsonObject()
jsonIn.UpdateString("payload.text", "https://www.chilkatsoft.com")
jsonIn.UpdateString("output.format", "png") # the default
jsonIn.UpdateString("output.return", "base64") # the default
jsonOut = chilkat2.JsonObject()
fmt = chilkat2.Formats()
if not fmt.QrCode("generate", jsonIn, jsonOut):
print(fmt.LastErrorText); exit()
png = chilkat2.BinData()
png.AppendEncoded(jsonOut.StringOf("outputs[0].base64"), "base64")
png.WriteFile("qr.png")Formats, have the same methods and the same JSON requests in every supported language: C, C++, C#, VB.NET, Java, Objective-C, Swift, Python, PHP, Perl, Ruby, Node.js, Electron, React Native, Dart / Flutter, Go, Rust, Zig, Delphi, C++Builder, Free Pascal / Lazarus, Classic ASP, VB6, VBScript, FoxPro, DataFlex, PowerBuilder, Xojo, Xbase++, PureBasic, AutoIt, B4A / B4J, LabVIEW, SQL Server and Tcl. See Chilkat Downloads for Every Language.<img src="data:image/png;base64,...">, a JSON API response, or an email.SVG
Resolution-independent vector output
An SVG output is a small standalone document: one <rect> per run of dark modules (and per caption glyph rectangle), integer coordinates, shape-rendering="crispEdges", no text elements, transforms or CSS. It scales to any size without blurring and is trivially embedded in web pages or printed documents. With physical units the root element carries real-world width/height (e.g. 18.80mm) and a pixel viewBox.
<?xml version="1.0" encoding="UTF-8"?>
<svg xmlns="http://www.w3.org/2000/svg" width="195px" height="195px" viewBox="0 0 195 195" shape-rendering="crispEdges" xmlns:c2pa="http://c2pa.org/manifest"><metadata><c2pa:manifest>A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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAPZYQAJ86bvoL72SQiW7/xGUeDgIyOv+FZJFY1yNGDdI5ZLi4EMKwljnStxC0JM6Jl+mTedyx+cvs2t9BK1VkSVuVDg=</c2pa:manifest></metadata>
<rect x="34" y="24" width="42" height="6" fill="#128A76"/>
<rect x="88" y="24" width="6" height="6" fill="#128A76"/>
<rect x="100" y="24" width="12" height="6" fill="#128A76"/>
<rect x="118" y="24" width="42" height="6" fill="#128A76"/>
...
</svg>Above: an SVG with a transparent background, green modules and a caption, embedded directly in this page over a tinted box so the transparency is visible.
jsonIn.UpdateString("output.format", "svg");
jsonIn.UpdateString("output.return", "text");
if (!fmt.QrCode("generate", jsonIn, jsonOut)) { Console.WriteLine(fmt.LastErrorText); return; }
string svg = jsonOut.StringOf("outputs[0].text"); // "<?xml version=..."jsonIn.UpdateString("output.format", "svg");
jsonIn.UpdateString("output.return", "text");
if (!fmt.QrCode("generate", jsonIn, jsonOut)) { std::cout << fmt.lastErrorText() << "\r\n"; return; }
const char *svg = jsonOut.stringOf("outputs[0].text"); // "<?xml version=..."jsonIn.UpdateString("output.format", "svg")
jsonIn.UpdateString("output.return", "text")
if not fmt.QrCode("generate", jsonIn, jsonOut):
print(fmt.LastErrorText); exit()
svg = jsonOut.StringOf("outputs[0].text") # "<?xml version=..."return: "text" with format: "png" is rejected (conflictingOptions at /output/return); PNG is binary and travels as base64.
Files
Writing output directly to disk
Give output.path (one symbol) or output.pathTemplate (any number of symbols) and Chilkat writes the file(s) for you. Combine with "return": "none" when the image is not needed in the response, or keep the default to get both.
{ "payload": { "text": "https://www.chilkatsoft.com" },
"output": { "format": "svg", "return": "none", "path": "/var/www/images/qr.svg", "overwrite": true } }{ "payload": { "type": "binary", "base64": "...up to 64 KiB..." },
"encoding": { "structuredAppend": { "enabled": true, "maxSymbols": 8 }, "qr": { "errorCorrection": "L" } },
"output": { "return": "none", "pathTemplate": "/labels/part{index}.png" } }
// writes /labels/part1.png, /labels/part2.png, ... and reports each in outputs[].pathOverwrite semantics
- With
"overwrite": false(the default), every destination is checked for existence before anything is written. If any exists, the request fails withoutputFailedat/output/pathor/output/pathTemplateand no file is touched. - With
"overwrite": true, existing files are replaced. - If a write fails part-way (disk full, missing directory, permissions), the request fails with
outputFailed; the message states how many files had already been written. Files written before the failure are left in place — there is no rollback. - Files are written with Chilkat's ordinary file routines; paths are UTF-8 and may be relative to the process's working directory.
{ "errors": [ { "code": "outputFailed", "path": "",
"message": "failed to write the output file (output 2); 2 output file(s) were written before the failure" } ],
"warnings": [] }Module data
The symbol as a bit-matrix
With "includeModuleData": true, each symbol carries its raw module grid — useful for custom rendering (a different drawing library, e-ink displays, embroidery, …) while leaving the encoding to Chilkat.
{ "kind": "bitMatrix", "width": 29, "height": 29, "rowBytes": 4,
"bytesBase64": "/n6+ ... ", // rows top to bottom, MSB-first bits, 1 = dark, zero-padded to rowBytes
"protectedRegionsBase64": "/n6+ ... " // same layout; 1 = function pattern (finder, timing, alignment, format/version) }The matrix covers the symbol only (no quiet zone, no caption). protectedRegions marks the function patterns that a reader relies on, which is what a future logo/styling feature must leave untouched.
Chilkat.BinData bits = new Chilkat.BinData();
bits.AppendEncoded(jsonOut.StringOf("symbols[0].moduleData.bytesBase64"), "base64");
int w = jsonOut.IntOf("symbols[0].moduleData.width");
int h = jsonOut.IntOf("symbols[0].moduleData.height");
int rowBytes = jsonOut.IntOf("symbols[0].moduleData.rowBytes");
byte[] m = bits.GetBytes();
for (int y = 0; y < h; y++) {
for (int x = 0; x < w; x++) {
bool dark = (m[y * rowBytes + x / 8] & (0x80 >> (x % 8))) != 0;
// draw (x, y) if dark
}
}import base64
md = base64.b64decode(jsonOut.StringOf("symbols[0].moduleData.bytesBase64"))
w = jsonOut.IntOf("symbols[0].moduleData.width")
h = jsonOut.IntOf("symbols[0].moduleData.height")
rowBytes = jsonOut.IntOf("symbols[0].moduleData.rowBytes")
for y in range(h):
row = "".join("#" if md[y * rowBytes + x // 8] & (0x80 >> (x % 8)) else " " for x in range(w))
print(row)Definition
A reusable request fragment
With "includeDefinition": true the response contains definition: the canonical symbology, payload and normalized encoding constraints of the request, with defaults made explicit but automatic choices kept as "auto". Copy it into a later generate request to reproduce the same symbol family (e.g. the same label with a different size), or store it alongside the image as a record of how it was made.
{ "symbology": "qr",
"payload": { "type": "text", "text": "ORDER-12345" },
"encoding": { "qr": { "version": "auto", "errorCorrection": "Q", "mask": "auto", "mode": "auto" },
"structuredAppend": { "enabled": false } } }