Imported from reason-machines/design-skills (
skills/aipixelperfect-design-engine/SKILL.md). Install upstream withnpx skills add reason-machines/design-skills --skill aipixelperfect-design-engine. Copyright stays with the author.
AiPixelPerfect Design Engine
Skill by ara.so — Design Skills collection
Overview
AiPixelPerfect is an AI-powered image generation platform that transforms text prompts into professional-quality visual designs. Built on modified Stable Diffusion with custom attention layers, it provides a design synergy engine for creating logos, banners, visualizations, and complex graphics without traditional design software.
Key Capabilities:
- Text-to-image synthesis with contextual understanding
- Multi-language prompt interpretation with cultural adaptation
- Real-time collaborative design review
- Responsive UI for cross-device workflows
- Export integration with Figma, Adobe Creative Cloud, and Canva
Installation
Web Platform Access
The primary interface is web-based. Access through the repository's hosted interface:
# Clone the repository for local development
git clone https://github.com/abnormal-codex/Ai-Pixel-Design-Archive.git
cd Ai-Pixel-Design-Archive
# Install dependencies (Next.js frontend)
npm install
# Set up environment variables
cp .env.example .env.local
Environment Configuration
Create .env.local with required credentials:
# API Configuration
AIPIXEL_API_KEY=${AIPIXEL_API_KEY}
AIPIXEL_API_ENDPOINT=https://api.aipixelperfect.com/v1
# Neural Backend
STABLE_DIFFUSION_MODEL_PATH=/models/custom-sd
ATTENTION_LAYER_CONFIG=finetuned
# Collaboration Layer
WEBSOCKET_SERVER=wss://collab.aipixelperfect.com
REVIEW_BOARD_ENDPOINT=${REVIEW_BOARD_ENDPOINT}
# Export Bridges
FIGMA_API_TOKEN=${FIGMA_API_TOKEN}
ADOBE_CLIENT_ID=${ADOBE_CLIENT_ID}
CANVA_INTEGRATION_KEY=${CANVA_INTEGRATION_KEY}
Development Server
# Start local development environment
npm run dev
# Production build
npm run build
npm start
Core API Usage
REST API Integration
// Initialize the AiPixelPerfect client
const AiPixelClient = require('aipixelperfect-sdk');
const client = new AiPixelClient({
apiKey: process.env.AIPIXEL_API_KEY,
endpoint: process.env.AIPIXEL_API_ENDPOINT
});
// Basic image synthesis
async function generateDesign(prompt) {
const result = await client.synthesize({
prompt: prompt,
variations: 4,
resolution: '2048x2048',
styleWeight: 0.7,
culturalContext: 'en-US'
});
return result.images; // Array of image URLs
}
// Example usage
const designs = await generateDesign(
'minimalist tech startup logo with geometric shapes'
);
console.log(`Generated ${designs.length} variations`);
Advanced Synthesis with Parameters
// Fine-tuned generation with style controls
async function advancedSynthesis(config) {
const result = await client.synthesize({
prompt: config.prompt,
variations: config.variations || 4,
resolution: config.resolution || '4096x4096',
// Style parameters
styleWeight: config.styleWeight || 0.8,
brightness: config.brightness || 0.5,
contrast: config.contrast || 0.6,
saturation: config.saturation || 0.7,
// Cultural adaptation
culturalContext: config.language || 'en-US',
regionalPalette: config.palette || 'global',
// Advanced options
seedValue: config.seed || null,
guidanceScale: config.guidance || 7.5,
steps: config.steps || 50
});
return {
images: result.images,
metadata: result.metadata,
generationTime: result.timing
};
}
// Usage with full control
const output = await advancedSynthesis({
prompt: 'futuristic cityscape at sunset with neon reflections',
resolution: '8192x4096',
styleWeight: 0.9,
culturalContext: 'ja-JP',
regionalPalette: 'asian',
guidanceScale: 8.0,
steps: 75
});
Prompt Engineering Patterns
Basic Prompt Structure
// Effective prompt composition
function buildPrompt(subject, style, details, mood) {
return `${subject}, ${style} style, ${details}, ${mood} atmosphere`;
}
// Examples
const logoPrompt = buildPrompt(
'abstract bird symbol',
'geometric minimalist',
'clean lines, negative space',
'professional and modern'
);
const bannerPrompt = buildPrompt(
'tech conference banner',
'gradient digital',
'circuit patterns, holographic elements',
'innovative and dynamic'
);
Multi-Language Prompts
// Cultural-aware synthesis
async function generateCulturalDesign(prompt, locale) {
const culturalConfig = {
'ja-JP': { palette: 'asian', saturation: 0.6 },
'es-MX': { palette: 'latin', saturation: 0.9 },
'ar-SA': { palette: 'middle-east', contrast: 0.7 }
};
const config = culturalConfig[locale] || {};
return await client.synthesize({
prompt: prompt,
culturalContext: locale,
regionalPalette: config.palette,
saturation: config.saturation,
contrast: config.contrast
});
}
// Japanese design with appropriate aesthetics
const japaneseDesign = await generateCulturalDesign(
'桜の花と富士山の伝統的なポスター',
'ja-JP'
);
Collaborative Review Workflow
Submitting Designs for Review
// Create a review submission
async function submitForReview(designId, metadata) {
const review = await client.review.create({
designId: designId,
prompt: metadata.prompt,
resolution: metadata.resolution,
generationTime: metadata.timing,
tags: metadata.tags || [],
annotations: []
});
return review.reviewId;
}
// Add annotations
async function annotateDesign(reviewId, annotation) {
await client.review.annotate(reviewId, {
type: annotation.type, // 'circle', 'rect', 'arrow'
x: annotation.x,
y: annotation.y,
width: annotation.width,
height: annotation.height,
comment: annotation.comment,
suggestion: annotation.suggestion || null
});
}
// Example workflow
const reviewId = await submitForReview('design-abc123', {
prompt: 'corporate logo design',
resolution: '2048x2048',
timing: 8.3,
tags: ['logo', 'corporate', 'blue']
});
await annotateDesign(reviewId, {
type: 'circle',
x: 512,
y: 512,
width: 200,
height: 200,
comment: 'Consider increasing contrast in this area',
suggestion: 'add sharper edges to geometric elements'
});
Voting and Approval
// Review voting system
async function voteOnDesign(reviewId, vote, userId) {
await client.review.vote(reviewId, {
userId: userId,
vote: vote, // 'approved', 'needs-revision', 'out-of-scope'
comment: vote.comment || ''
});
}
// Check review status
async function getReviewStatus(reviewId) {
const status = await client.review.getStatus(reviewId);
return {
approved: status.votes.approved,
needsRevision: status.votes.needsRevision,
outOfScope: status.votes.outOfScope,
totalVotes: status.votes.total
};
}
Export Integration
Figma Export
// Export directly to Figma
async function exportToFigma(designId, figmaConfig) {
const result = await client.export.toFigma({
designId: designId,
figmaToken: process.env.FIGMA_API_TOKEN,
fileKey: figmaConfig.fileKey,
nodeId: figmaConfig.nodeId,
layerName: figmaConfig.layerName || 'AI Generated Design',
maintainTransparency: true
});
return result.figmaUrl;
}
// Usage
const figmaUrl = await exportToFigma('design-xyz789', {
fileKey: 'abc123def456',
nodeId: '123:456',
layerName: 'Hero Banner'
});
Adobe Creative Cloud Export
// Export to Adobe CC Libraries
async function exportToAdobe(designId, adobeConfig) {
const result = await client.export.toAdobe({
designId: designId,
clientId: process.env.ADOBE_CLIENT_ID,
libraryId: adobeConfig.libraryId,
assetName: adobeConfig.assetName,
format: adobeConfig.format || 'png',
colorProfile: 'sRGB'
});
return result.adobeAssetUrl;
}
Batch Export
// Export multiple designs simultaneously
async function batchExport(designIds, format, destination) {
const exports = await Promise.all(
designIds.map(id =>
client.export.toFile({
designId: id,
format: format, // 'png', 'jpg', 'webp', 'tiff'
resolution: '4096x4096',
destination: destination
})
)
);
return exports.map(e => e.filePath);
}
// Export to local directory
const files = await batchExport(
['design-1', 'design-2', 'design-3'],
'png',
'./exports/'
);
Real-Time Collaboration
WebSocket Connection
// Establish real-time collaboration session
const WebSocket = require('ws');
function connectCollaboration(reviewId, userId) {
const ws = new WebSocket(process.env.WEBSOCKET_SERVER);
ws.on('open', () => {
ws.send(JSON.stringify({
action: 'join',
reviewId: reviewId,
userId: userId
}));
});
ws.on('message', (data) => {
const event = JSON.parse(data);
handleCollabEvent(event);
});
return ws;
}
function handleCollabEvent(event) {
switch(event.type) {
case 'annotation-added':
console.log(`New annotation by ${event.user}:`, event.annotation);
break;
case 'vote-updated':
console.log(`Vote cast: ${event.vote}`);
break;
case 'comment-posted':
console.log(`Comment: ${event.comment}`);
break;
}
}
Refinement and Iteration
Dial-In Adjustments
// Refine existing design
async function refineDesign(designId, adjustments) {
const refined = await client.refine({
baseDesignId: designId,
adjustments: {
brightness: adjustments.brightness || 0,
contrast: adjustments.contrast || 0,
saturation: adjustments.saturation || 0,
styleWeight: adjustments.styleWeight || 0
},
regenerate: adjustments.regenerate || false
});
return refined.refinedDesignId;
}
// Usage: brighten and increase contrast
const refinedId = await refineDesign('design-abc', {
brightness: 0.2,
contrast: 0.3,
regenerate: true
});
Iterative Prompt Evolution
// Evolve prompt based on previous results
async function evolvePrompt(basePrompt, feedback) {
const evolved = await client.prompt.evolve({
basePrompt: basePrompt,
keepElements: feedback.keep || [],
removeElements: feedback.remove || [],
addElements: feedback.add || [],
styleShift: feedback.styleShift || 0
});
return evolved.newPrompt;
}
// Example iteration
const newPrompt = await evolvePrompt(
'modern tech logo with circuits',
{
keep: ['modern', 'tech'],
remove: ['circuits'],
add: ['geometric shapes', 'gradient'],
styleShift: 0.2
}
);
console.log('Evolved prompt:', newPrompt);
// Output: "modern tech logo with geometric shapes and gradient"
Configuration
Custom Style Presets
// Create reusable style preset
async function createStylePreset(name, parameters) {
const preset = await client.styles.create({
name: name,
parameters: {
styleWeight: parameters.styleWeight,
brightness: parameters.brightness,
contrast: parameters.contrast,
saturation: parameters.saturation,
guidanceScale: parameters.guidanceScale,
steps: parameters.steps
},
tags: parameters.tags || []
});
return preset.presetId;
}
// Apply preset
async function generateWithPreset(prompt, presetId) {
return await client.synthesize({
prompt: prompt,
stylePreset: presetId
});
}
// Example: Create brand preset
const brandPreset = await createStylePreset('corporate-blue', {
styleWeight: 0.8,
brightness: 0.5,
contrast: 0.7,
saturation: 0.6,
guidanceScale: 8.0,
steps: 60,
tags: ['corporate', 'professional', 'blue']
});
Common Patterns
Design Variation Pipeline
// Generate multiple variations and select best
async function variationPipeline(prompt, count = 8) {
const designs = await client.synthesize({
prompt: prompt,
variations: count,
resolution: '2048x2048'
});
// Auto-score based on criteria
const scored = designs.images.map((img, idx) => ({
imageUrl: img.url,
score: scoreDesign(img.metadata)
}));
// Return top 3
return scored
.sort((a, b) => b.score - a.score)
.slice(0, 3);
}
function scoreDesign(metadata) {
// Custom scoring logic
return (
metadata.sharpness * 0.3 +
metadata.colorBalance * 0.3 +
metadata.composition * 0.4
);
}
Responsive Asset Generation
// Generate multiple resolutions for responsive design
async function generateResponsiveSet(prompt, breakpoints) {
const assets = await Promise.all(
breakpoints.map(bp =>
client.synthesize({
prompt: prompt,
resolution: bp.resolution,
variations: 1
}).then(result => ({
breakpoint: bp.name,
resolution: bp.resolution,
imageUrl: result.images[0].url
}))
)
);
return assets;
}
// Usage
const responsiveSet = await generateResponsiveSet(
'hero banner for tech website',
[
{ name: 'desktop', resolution: '1920x1080' },
{ name: 'tablet', resolution: '1024x768' },
{ name: 'mobile', resolution: '640x480' }
]
);
Troubleshooting
Generation Failures
// Retry with exponential backoff
async function generateWithRetry(prompt, maxRetries = 3) {
for (let i = 0; i < maxRetries; i++) {
try {
const result = await client.synthesize({ prompt });
return result;
} catch (error) {
if (error.code === 'RATE_LIMIT') {
const delay = Math.pow(2, i) * 1000;
console.log(`Rate limited. Retrying in ${delay}ms...`);
await new Promise(resolve => setTimeout(resolve, delay));
} else if (error.code === 'CONTENT_POLICY_VIOLATION') {
throw new Error(`Prompt violates content policy: ${error.details}`);
} else {
throw error;
}
}
}
throw new Error('Max retries exceeded');
}
Copyright Conflict Detection
// Check for style conflicts before generation
async function checkPromptSafety(prompt) {
const analysis = await client.prompt.analyze({
prompt: prompt,
checkCopyright: true,
checkTrademark: true
});
if (analysis.conflicts.length > 0) {
console.warn('Potential conflicts detected:');
analysis.conflicts.forEach(conflict => {
console.warn(`- ${conflict.type}: ${conflict.description}`);
});
return {
safe: false,
conflicts: analysis.conflicts,
suggestions: analysis.alternatives
};
}
return { safe: true };
}
// Usage
const safety = await checkPromptSafety('logo like Apple company');
if (!safety.safe) {
console.log('Consider these alternatives:', safety.suggestions);
}
Performance Optimization
// Cache frequently used designs
const NodeCache = require('node-cache');
const designCache = new NodeCache({ stdTTL: 3600 });
async function getCachedDesign(prompt, options) {
const cacheKey = `${prompt}-${JSON.stringify(options)}`;
const cached = designCache.get(cacheKey);
if (cached) {
console.log('Returning cached design');
return cached;
}
const result = await client.synthesize({
prompt,
...options
});
designCache.set(cacheKey, result);
return result;
}
Quality Validation
// Validate output quality before accepting
function validateDesignQuality(metadata, thresholds) {
const checks = {
sharpness: metadata.sharpness >= (thresholds.sharpness || 0.7),
colorBalance: metadata.colorBalance >= (thresholds.colorBalance || 0.6),
composition: metadata.composition >= (thresholds.composition || 0.7),
resolution: metadata.actualResolution === metadata.requestedResolution
};
const passed = Object.values(checks).every(c => c === true);
return {
passed,
checks,
score: Object.values(checks).filter(c => c).length / Object.keys(checks).length
};
}
// Regenerate if quality insufficient
async function generateUntilQuality(prompt, qualityThreshold = 0.8) {
let attempts = 0;
const maxAttempts = 5;
while (attempts < maxAttempts) {
const result = await client.synthesize({ prompt });
const validation = validateDesignQuality(
result.images[0].metadata,
{ sharpness: 0.75, colorBalance: 0.7, composition: 0.75 }
);
if (validation.score >= qualityThreshold) {
return result;
}
attempts++;
console.log(`Quality score ${validation.score} below threshold. Retrying...`);
}
throw new Error('Could not achieve quality threshold');
}
CLI Usage (if available)
# Generate design from command line
aipixel generate "minimalist logo" --variations 4 --resolution 2048x2048
# Apply style preset
aipixel generate "hero banner" --preset corporate-blue
# Export to specific format
aipixel export design-abc123 --format png --output ./exports/
# Batch processing
aipixel batch process prompts.txt --output ./batch-results/
# Review management
aipixel review create design-xyz789 --tags logo,corporate
aipixel review annotate review-123 --x 512 --y 512 --comment "Increase contrast"
Best Practices
- Prompt Specificity: Include subject, style, details, and mood for best results
- Cultural Context: Always specify language/region for culturally-aware designs
- Iterative Refinement: Use the dial-in system for fine adjustments rather than regenerating
- Quality Validation: Implement quality checks before accepting designs
- Caching: Cache frequently generated designs to reduce API calls
- Error Handling: Always check for copyright conflicts before commercial use
- Batch Operations: Use batch APIs for multiple designs to optimize performance
- Version Control: Track prompt iterations and refinements in review system