Skip to content

Generating and Vectorising Logos

This Workflow generates a raster logo with Flux Schnell and converts it to an SVG with Recraft’s image-to-vector model. The output is an infinitely scalable vector file ready for a website, app icon, or print asset — all in a single API call.

Generated raster logoVectorised output
Generated raster paper-airplane logoVector paper-airplane logo
Terminal window
# Create a project directory.
mkdir prodia-vectorise-workflow
cd prodia-vectorise-workflow

Install Node (if not already installed):

Terminal window
brew install node
# Close the current terminal and open a new one so that node is available.

Create project skeleton:

Terminal window
# Requires node --version >= 18
# Initialize the project with npm.
npm init -y
# Install the prodia-js library.
npm install prodia --save
Terminal window
# Export your token so it can be used by the main code.
export PRODIA_TOKEN=your-token-here

Your token is exported to an environment variable. If you close or switch your shell you’ll need to run export PRODIA_TOKEN=your-token-here again.

Create a main file for your project:

main.js
const { createProdia } = require("prodia/v2");
const prodia = createProdia({
token: process.env.PRODIA_TOKEN // get it from environment
});

You’re now ready to make some API calls!

Generate then vectorise (in a single workflow)

Section titled “Generate then vectorise (in a single workflow)”

The first job generates a flat, vector-friendly raster image. The second job receives that raster and converts it into an SVG.

main.js
const { createProdia } = require("prodia/v2");
const fs = require("node:fs/promises");
const prodia = createProdia({
token: process.env.PRODIA_TOKEN,
});
(async () => {
const job = await prodia.job({
type: "workflow.serial.v1",
config: {
jobs: [
{
type: "inference.flux-fast.schnell.txt2img.v2",
config: {
prompt: "minimalist flat logo of a paper airplane flying upward, bold geometric shapes, two-tone blue and white, plain solid background, vector-friendly silhouette",
width: 1024,
height: 1024,
seed: 42,
},
},
{
type: "inference.recraft.img2vec.v1",
},
],
},
}, {
accept: "image/svg+xml",
});
const svg = await job.arrayBuffer();
await fs.writeFile("logo.svg", new Uint8Array(svg));
// open logo.svg
})();
Terminal window
node main.js
Terminal window
open logo.svg
  • Prompt for vector-friendly raster output. Flat, two- or three-colour designs with sharp silhouettes vectorise well. Photo-realistic or gradient-heavy images will produce SVGs with hundreds of paths and won’t look like a logo.
  • Native vector generation. If you don’t need to start from a raster, Recraft V4 supports inference.recraft.v4.txt2vec.v1 and inference.recraft.v4.pro.txt2vec.v1 which generate SVGs directly from a prompt — see Vectorising Images.