Skip to content

Quick Start

This guide walks you through creating a complete image workflow using FloImg.

Transform images instantly from your terminal:

Terminal window
# Resize for social media
npx @teamflojo/floimg resize hero.png 1200x630 -o og-image.png
# Convert to WebP
npx @teamflojo/floimg convert image.png -o image.webp
# Add a caption or watermark
npx @teamflojo/floimg caption photo.jpg "© 2025 Acme" -o watermarked.jpg
# Generate with AI (requires OPENAI_API_KEY)
npx @teamflojo/floimg generate openai "A mountain landscape at sunset" -o landscape.png
# Also: charts, diagrams, QR codes
npx @teamflojo/floimg qr "https://floimg.com" -o qr.png

See the CLI docs for all available commands.


For integration into your applications, use the FloImg SDK.

Make sure you have installed floimg.

Every floimg workflow starts with a client:

import createClient from '@teamflojo/floimg';
const floimg = createClient();

Generators create images. Register the ones you need:

import openai from '@teamflojo/floimg-openai';
floimg.registerGenerator(openai({
apiKey: process.env.OPENAI_API_KEY
}));

Use the generate method with a generator name and parameters:

const image = await floimg.generate({
generator: 'openai',
params: {
prompt: 'A serene mountain landscape at golden hour',
size: '1024x1024'
}
});

Apply transformations like resize, blur, or format conversion:

const resized = await floimg.transform(image, {
op: 'resize',
params: { width: 800, height: 600 }
});
const final = await floimg.transform(resized, {
op: 'modulate',
params: { saturation: 1.2 }
});

Save to local filesystem or cloud storage:

// Local file
await floimg.save(final, './output/landscape.png');
// S3 bucket (requires AWS credentials)
await floimg.save(final, 's3://my-bucket/images/landscape.png');

Here’s the full workflow:

import createClient from '@teamflojo/floimg';
import openai from '@teamflojo/floimg-openai';
async function main() {
// Initialize
const floimg = createClient();
floimg.registerGenerator(openai({
apiKey: process.env.OPENAI_API_KEY
}));
// Generate
const image = await floimg.generate({
generator: 'openai',
params: {
prompt: 'A professional product photo of wireless headphones on a minimalist background',
size: '1024x1024',
quality: 'hd'
}
});
// Transform for social media
const final = await floimg.transform(image, {
op: 'resize',
params: { width: 1200, height: 630 }
});
// Save
await floimg.save(final, './product-hero.png');
console.log('Image saved!');
}
main();