Skip to content

Vectorizing Images

Recraft V4 and V4 Pro can generate vector graphics (SVG) directly from text prompts. Unlike raster image generation which produces pixel-based output, vectorization produces infinitely scalable SVG files — perfect for logos, icons, illustrations, and print materials.

Job TypeResolutionETA
inference.recraft.v4.txt2vec.v1Up to 1536x768~28s
inference.recraft.v4.pro.txt2vec.v1Up to 3072x1536~45s

V4 Pro generates at higher resolution with more detail, but takes longer.

main.js
import fs from "node:fs/promises";
import { createProdia } from "prodia/v2";
const prodia = createProdia({
token: process.env.PRODIA_TOKEN,
});
const job = await prodia.job({
type: "inference.recraft.v4.txt2vec.v1",
config: {
prompt: "a minimalist logo of a mountain range at sunset",
},
});
const svg = await job.arrayBuffer();
await fs.writeFile("mountain.svg", new Uint8Array(svg));
console.log("Saved mountain.svg");
Terminal window
node main.js
Terminal window
open mountain.svg

Replace the job type with inference.recraft.v4.pro.txt2vec.v1 for higher resolution output:

main.js
const job = await prodia.job({
type: "inference.recraft.v4.pro.txt2vec.v1",
config: {
prompt: "a minimalist logo of a mountain range at sunset",
size: "2048x2048",
},
});

Both models support a controls parameter to specify color palettes and background colors:

main.js
const job = await prodia.job({
type: "inference.recraft.v4.txt2vec.v1",
config: {
prompt: "a flat icon of a coffee cup",
controls: {
colors: [
{ rgb: [139, 90, 43] },
{ rgb: [255, 255, 255] },
],
background_color: {
rgb: [245, 245, 220],
},
},
},
});

The response is an SVG file. SVGs are XML-based vector graphics that:

  • Scale to any size without quality loss
  • Are typically 100KB–1MB depending on complexity
  • Can be opened in any browser, Figma, Illustrator, or Inkscape
  • Can be embedded directly in HTML with <img src="output.svg">

Recraft V4 (inference.recraft.v4.txt2vec.v1):

Recraft V4 vector output — mountain landscape

Recraft V4 Pro (inference.recraft.v4.pro.txt2vec.v1):

Recraft V4 Pro vector output — mountain landscape

V4 (default: 1024x1024):

1024x1024, 1536x768, 768x1536, 1280x832, 832x1280, 1216x896, 896x1216, 1152x896, 896x1152, 832x1344, 1280x896, 896x1280, 1344x768, 768x1344

V4 Pro (default: 2048x2048):

2048x2048, 3072x1536, 1536x3072, 2560x1664, 1664x2560, 2432x1792, 1792x2432, 2304x1792, 1792x2304, 1664x2688, 2560x1792, 1792x2560, 2688x1536, 1536x2688