Skip to main content

Style Transfer

Apply the visual style of one image to another using transferStyle(), backed by Flux Redux and cross-provider img2img.


Overview

transferStyle() takes a source image and a style reference image, then produces an output that combines the content of the source with the visual aesthetic of the reference. This is useful for:

  • Converting photographs to specific art styles (oil painting, anime, pixel art)
  • Applying a brand's visual identity to generated content
  • Creating consistent visual themes across a set of images

transferStyle() API

import { transferStyle } from '@framers/agentos';

const result = await transferStyle({
image: './photo.jpg',
styleReference: './monet-waterlilies.jpg',
prompt: 'Impressionist oil painting, visible brushstrokes, warm golden light',
strength: 0.7,
});

console.log(result.images[0].url);
console.log(result.provider); // 'replicate'
console.log(result.model); // 'black-forest-labs/flux-redux-dev'

Parameters

ParameterTypeDefaultDescription
imagestring | BufferrequiredSource image (file path, URL, data URI, or Buffer)
styleReferencestring | BufferrequiredReference image whose style to apply
promptstringrequiredText guiding the transfer direction
strengthnumber0.7How much reference style to apply (0 = unchanged, 1 = full transfer)
providerstringauto-detectOverride provider selection
modelstringprovider defaultOverride model selection
sizestringOutput dimensions (e.g. '1024x1024')
negativePromptstringContent to avoid
seednumberReproducibility seed
policyTierstringContent policy tier for provider routing

Provider Routing

When no provider is specified, transferStyle() auto-detects the best available provider from environment variables:

PriorityProviderModelHow It Works
1ReplicateFlux Redux DevPurpose-built for image-guided generation. Style reference as primary input.
2FalFlux Devimg2img with style description in prompt
3Stabilitystable-image-coreimg2img with strength parameter
4OpenAIgpt-image-1editImage with descriptive prompt

Replicate with Flux Redux produces the best results for style transfer because the model was trained specifically for image-conditioned generation.

Strength Guide

RangeEffectUse Case
0.1–0.3Subtle color grading, minor texture shiftsBrand color overlays
0.4–0.6Moderate style influence, composition preserved"In the style of" variations
0.7–0.8Strong style transfer, content recognizableArt style conversion
0.9–1.0Near-complete adoption of reference aestheticFull aesthetic transformation

Examples

// Photograph → anime style
const anime = await transferStyle({
image: './portrait-photo.jpg',
styleReference: './ghibli-frame.png',
prompt: 'Studio Ghibli anime style, cel shading, vibrant colors',
strength: 0.75,
});

// Photograph → pixel art
const pixel = await transferStyle({
image: './landscape.jpg',
styleReference: './pixel-art-reference.png',
prompt: '16-bit pixel art, limited palette, retro game aesthetic',
strength: 0.8,
});

// Apply brand visual identity
const branded = await transferStyle({
image: './product-photo.jpg',
styleReference: './brand-style-guide.png',
prompt: 'Clean, modern, brand-consistent visual treatment',
strength: 0.5,
});