Skip to content
HALOWERK

Bildwerk

svg rasterize

Runs the svg-sanitize allowlist first (scripts, external references, foreignObject and entity declarations removed, only local #fragment references and raster data: images kept), then renders with librsvg 2.63 inside libvips/sharp in a resource-limited child process: the vector graphic is rendered at the density that matches each target width, so large sizes stay sharp. Each size gives width and/or height; the other side follows the intrinsic aspect ratio (from width/height or viewBox), with.

POST https://bild.halowerk.com/v1/svg-rasterize

Inputs

Fields of the published input schema
FieldTypeRequiredDescription
svgstringNoSVG markup.
svg_urlstringNoPublic URL of the SVG (at most 5 MB).
sizesarrayYesTarget sizes, e.g. [{"width":64},{"width":512}].
formatstringNo
fitstringNo
backgroundstringNoHex colour or "transparent" (JPEG uses white when transparent).
qualityintegerNo
Show full input schema
{
  "type": "object",
  "additionalProperties": false,
  "required": [
    "sizes"
  ],
  "properties": {
    "svg": {
      "type": "string",
      "minLength": 10,
      "maxLength": 5000000,
      "description": "SVG markup."
    },
    "svg_url": {
      "type": "string",
      "format": "uri",
      "maxLength": 2048,
      "description": "Public URL of the SVG (at most 5 MB)."
    },
    "sizes": {
      "type": "array",
      "minItems": 1,
      "maxItems": 12,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "width": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8192
          },
          "height": {
            "type": "integer",
            "minimum": 1,
            "maximum": 8192
          }
        }
      },
      "description": "Target sizes, e.g. [{\"width\":64},{\"width\":512}]."
    },
    "format": {
      "type": "string",
      "enum": [
        "png",
        "webp",
        "jpeg",
        "avif"
      ],
      "default": "png"
    },
    "fit": {
      "type": "string",
      "enum": [
        "contain",
        "cover",
        "fill"
      ],
      "default": "contain"
    },
    "background": {
      "type": "string",
      "maxLength": 11,
      "default": "transparent",
      "description": "Hex colour or \"transparent\" (JPEG uses white when transparent)."
    },
    "quality": {
      "type": "integer",
      "minimum": 1,
      "maximum": 100,
      "default": 90
    }
  }
}

Open original schema

Published input example

{
  "svg": "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 100 50\"><rect width=\"100\" height=\"50\" fill=\"#0243a9\"/></svg>",
  "sizes": [
    {
      "width": 32
    },
    {
      "width": 512
    }
  ],
  "format": "png"
}

Result & documentation

Machine-readable documentation of this hub

Source of this page: the published HALOWERK catalog. Updated: 2026-11-17 UTC.

More endpoints in this hub

All endpoints in this hub →