AI Pixel Perfect Design Generator
Skill by ara.so — Design Skills collection
Overview
AiPixelPerfect is a next-generation AI image generation platform that creates professional, pixel-perfect visual assets from text prompts. It acts as a design synergy engine bridging human intuition and machine precision, enabling anyone to produce studio-quality visuals without traditional design software expertise.
Core Capabilities:
- AI-powered design synthesis from text prompts
- Responsive UI across all devices
- Support for 40+ languages with cultural adaptation
- Real-time collaboration and design review
- Export to Figma, Adobe Creative Cloud, and Canva
- RESTful API for custom integrations
Installation
Web Interface Access
The primary interface is web-based. Access through the repository's hosted page:
# Navigate to the hosted application
open https://abnormal-codex.github.io/Ai-Pixel-Design-Archive/
API Integration Setup
For programmatic access, install the client library:
npm install @aipixelperfect/client
Or for Python projects:
pip install aipixelperfect-sdk
Configuration
Environment Variables
# API Configuration
export AIPIXELPERFECT_API_KEY=your_api_key_here
export AIPIXELPERFECT_ENDPOINT=https://api.aipixelperfect.com/v1
export AIPIXELPERFECT_TIMEOUT=30000
# Output Settings
export AIPIXELPERFECT_DEFAULT_RESOLUTION=2048
export AIPIXELPERFECT_OUTPUT_FORMAT=png
export AIPIXELPERFECT_STYLE_WEIGHT=0.7
# Collaboration
export AIPIXELPERFECT_WORKSPACE_ID=your_workspace_id
Configuration File
Create aipixelperfect.config.json in your project root:
{
"apiKey": "${AIPIXELPERFECT_API_KEY}",
"defaults": {
"resolution": "2048x2048",
"format": "png",
"variations": 4,
"styleWeight": 0.7
},
"export": {
"figma": {
"enabled": true,
"projectId": "your-figma-project-id"
},
"adobe": {
"enabled": false
}
},
"collaboration": {
"realtime": true,
"annotations": true
}
}
Core API Usage
JavaScript/Node.js Integration
import { AiPixelPerfect } from '@aipixelperfect/client';
// Initialize client
const client = new AiPixelPerfect({
apiKey: process.env.AIPIXELPERFECT_API_KEY,
endpoint: process.env.AIPIXELPERFECT_ENDPOINT
});
// Generate a design from text prompt
async function generateDesign(prompt) {
try {
const result = await client.synthesize({
prompt: "a futuristic cityscape at sunset with neon reflections",
variations: 4,
resolution: "2048x2048",
styleWeight: 0.8
});
return result.images;
} catch (error) {
console.error('Generation failed:', error);
throw error;
}
}
// Refine an existing design
async function refineDesign(imageId, adjustments) {
const refined = await client.refine({
imageId: imageId,
adjustments: {
brightness: 0.1,
contrast: -0.05,
saturation: 0.15,
styleWeight: 0.9
},
newPrompt: "add more vibrant colors and lighting effects"
});
return refined;
}
// Export to external tools
async function exportToFigma(imageId) {
const exported = await client.export({
imageId: imageId,
target: 'figma',
projectId: process.env.FIGMA_PROJECT_ID,
maintainLayers: true,
transparency: true
});
console.log(`Exported to Figma: ${exported.figmaUrl}`);
return exported;
}
Python Integration
from aipixelperfect import AiPixelPerfect
import os
# Initialize client
client = AiPixelPerfect(
api_key=os.getenv('AIPIXELPERFECT_API_KEY'),
endpoint=os.getenv('AIPIXELPERFECT_ENDPOINT')
)
# Generate design
def generate_design(prompt, language='en'):
result = client.synthesize(
prompt=prompt,
variations=4,
resolution=(2048, 2048),
style_weight=0.8,
language=language # Supports 40+ languages
)
return result['images']
# Batch generation
def batch_generate(prompts):
results = []
for prompt in prompts:
try:
images = client.synthesize(
prompt=prompt,
variations=2,
resolution=(1024, 1024)
)
results.append({
'prompt': prompt,
'images': images
})
except Exception as e:
print(f"Failed for prompt '{prompt}': {e}")
return results
# Cultural adaptation example
def generate_localized_design(concept, locale):
"""Generate design adapted to cultural preferences"""
result = client.synthesize(
prompt=concept,
language=locale,
cultural_adaptation=True, # Enables regional color palettes
variations=3
)
return result
HTML/Frontend Integration
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>AiPixelPerfect Design Generator</title>
<style>
.design-canvas {
width: 100%;
max-width: 800px;
margin: 0 auto;
padding: 20px;
}
.prompt-input {
width: 100%;
padding: 12px;
font-size: 16px;
border: 2px solid #333;
border-radius: 8px;
}
.variations-grid {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
gap: 20px;
margin-top: 20px;
}
.design-card {
border: 1px solid #ddd;
border-radius: 8px;
overflow: hidden;
cursor: pointer;
transition: transform 0.2s;
}
.design-card:hover {
transform: scale(1.02);
}
.design-card img {
width: 100%;
height: auto;
}
</style>
</head>
<body>
<div class="design-canvas">
<h1>AI Design Generator</h1>
<input
type="text"
class="prompt-input"
id="promptInput"
placeholder="Describe your design concept..."
/>
<button
<div id="variations" class="variations-grid"></div>
</div>
<script>
const API_KEY = localStorage.getItem('aipixelperfect_api_key');
const API_ENDPOINT = 'https://api.aipixelperfect.com/v1';
async function generateDesign() {
const prompt = document.getElementById('promptInput').value;
if (!prompt) {
alert('Please enter a design concept');
return;
}
try {
const response = await fetch(`${API_ENDPOINT}/synthesize`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
prompt: prompt,
variations: 4,
resolution: '1024x1024',
styleWeight: 0.7
})
});
const result = await response.json();
displayVariations(result.images);
} catch (error) {
console.error('Generation failed:', error);
alert('Failed to generate design. Please try again.');
}
}
function displayVariations(images) {
const container = document.getElementById('variations');
container.innerHTML = '';
images.forEach((image, index) => {
const card = document.createElement('div');
card.className = 'design-card';
card.innerHTML = `
<img src="${image.url}" alt="Variation ${index + 1}">
<div style="padding: 10px;">
<button
<button
</div>
`;
container.appendChild(card);
});
}
async function refineDesign(imageId) {
// Refinement logic
const newPrompt = prompt('Enter refinement instructions:');
const response = await fetch(`${API_ENDPOINT}/refine`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
imageId: imageId,
newPrompt: newPrompt,
adjustments: {
brightness: 0.1,
contrast: 0.05
}
})
});
const result = await response.json();
console.log('Refined design:', result);
}
async function exportDesign(imageId) {
const target = prompt('Export to (figma/adobe/canva):');
const response = await fetch(`${API_ENDPOINT}/export`, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': `Bearer ${API_KEY}`
},
body: JSON.stringify({
imageId: imageId,
target: target,
maintainLayers: true
})
});
const result = await response.json();
window.open(result.exportUrl, '_blank');
}
</script>
</body>
</html>
Common Design Patterns
Iterative Refinement Workflow
async function iterativeDesignProcess(initialPrompt) {
// Generate initial variations
let designs = await client.synthesize({
prompt: initialPrompt,
variations: 4
});
// Select best variation
const selectedId = designs.images[0].id;
// Refine in stages
const refinementStages = [
{ brightness: 0.1, contrast: 0.05 },
{ saturation: 0.15, styleWeight: 0.9 },
{ prompt: "add more detail and texture" }
];
let currentDesign = selectedId;
for (const stage of refinementStages) {
const refined = await client.refine({
imageId: currentDesign,
...stage
});
currentDesign = refined.id;
}
return currentDesign;
}
Batch Processing with Queue
import Queue from 'bull';
const designQueue = new Queue('design-generation', {
redis: { host: 'localhost', port: 6379 }
});
// Add jobs to queue
async function queueDesignGeneration(prompts) {
for (const prompt of prompts) {
await designQueue.add('generate', {
prompt: prompt,
variations: 2,
resolution: '1024x1024'
});
}
}
// Process queue
designQueue.process('generate', async (job) => {
const { prompt, variations, resolution } = job.data;
try {
const result = await client.synthesize({
prompt,
variations,
resolution
});
return result;
} catch (error) {
console.error(`Failed to generate design for: ${prompt}`, error);
throw error;
}
});
// Monitor progress
designQueue.on('completed', (job, result) => {
console.log(`Design generated: ${job.id}`);
});
Style Transfer and Custom Styles
# Create and save custom art style
def create_custom_style(sample_images, style_name):
"""Generate custom style from sample images"""
style = client.create_style(
name=style_name,
sample_images=sample_images,
training_iterations=1000
)
return style['style_id']
# Apply custom style to generation
def generate_with_custom_style(prompt, style_id):
result = client.synthesize(
prompt=prompt,
custom_style_id=style_id,
style_weight=1.0,
variations=3
)
return result['images']
# Style mixing
def mix_styles(prompt, style_ids, weights):
"""Combine multiple styles with weights"""
result = client.synthesize(
prompt=prompt,
style_mix=[
{'style_id': sid, 'weight': w}
for sid, w in zip(style_ids, weights)
],
variations=4
)
return result['images']
Real-time Collaboration
import { io } from 'socket.io-client';
// Connect to collaboration server
const socket = io(process.env.AIPIXELPERFECT_COLLAB_URL, {
auth: {
token: process.env.AIPIXELPERFECT_API_KEY
}
});
// Join design session
socket.emit('join-session', {
sessionId: 'design-session-123',
userId: 'user-456'
});
// Listen for design updates
socket.on('design-updated', (data) => {
console.log('Design updated by:', data.userId);
console.log('Changes:', data.changes);
updateLocalDesign(data.imageId, data.changes);
});
// Submit annotation
function annotateDesign(imageId, annotation) {
socket.emit('add-annotation', {
imageId: imageId,
annotation: {
x: annotation.x,
y: annotation.y,
width: annotation.width,
height: annotation.height,
comment: annotation.comment,
type: 'suggestion' // or 'issue', 'approved'
}
});
}
// Vote on design
function voteOnDesign(imageId, vote) {
socket.emit('vote', {
imageId: imageId,
vote: vote // 'approved', 'needs-revision', 'out-of-scope'
});
}
Advanced Features
Cultural Adaptation
# Generate design adapted to specific culture
def generate_culturally_adapted_design(concept, locale):
"""
Generates design with cultural awareness
Supports: ja (Japanese), es (Spanish), ar (Arabic), etc.
"""
result = client.synthesize(
prompt=concept,
language=locale,
cultural_adaptation={
'enabled': True,
'color_palette': 'regional',
'symbolism': 'local',
'composition': 'culturally_appropriate'
},
variations=4
)
return result['images']
# Example: Japanese aesthetic
japanese_design = generate_culturally_adapted_design(
concept="peaceful garden with water elements",
locale="ja"
)
# Example: Latin American vibrancy
latin_design = generate_culturally_adapted_design(
concept="festival celebration with music",
locale="es-MX"
)
Prompt Engineering Helpers
// Use Prompt Scribe assistant
async function buildComplexPrompt(keywords) {
const prompt = await client.promptScribe({
keywords: keywords,
style: 'professional',
detail_level: 'high',
mood: 'energetic'
});
return prompt.enhancedPrompt;
}
// Example usage
const keywords = ['logo', 'technology', 'blue', 'minimal'];
const enhancedPrompt = await buildComplexPrompt(keywords);
const design = await client.synthesize({
prompt: enhancedPrompt,
variations: 4
});
Copyright Detection
// Check prompt for potential conflicts
async function validatePrompt(prompt) {
const validation = await client.validatePrompt({
prompt: prompt,
checkCopyright: true,
checkTrademark: true
});
if (validation.conflicts.length > 0) {
console.warn('Potential conflicts detected:');
validation.conflicts.forEach(conflict => {
console.log(`- ${conflict.type}: ${conflict.description}`);
console.log(` Suggested alternative: ${conflict.alternative}`);
});
return false;
}
return true;
}
// Safe generation workflow
async function safeGenerate(prompt) {
const isValid = await validatePrompt(prompt);
if (!isValid) {
throw new Error('Prompt validation failed - potential copyright issues');
}
return await client.synthesize({ prompt });
}
Troubleshooting
Common Issues
Issue: Generation timeout
// Increase timeout and add retry logic
const client = new AiPixelPerfect({
apiKey: process.env.AIPIXELPERFECT_API_KEY,
timeout: 60000, // 60 seconds
retries: 3,
retryDelay: 5000
});
async function generateWithRetry(prompt, maxAttempts = 3) {
for (let i = 0; i < maxAttempts; i++) {
try {
return await client.synthesize({ prompt });
} catch (error) {
if (i === maxAttempts - 1) throw error;
console.log(`Attempt ${i + 1} failed, retrying...`);
await new Promise(resolve => setTimeout(resolve, 5000));
}
}
}
Issue: Low quality outputs
// Adjust quality settings
const result = await client.synthesize({
prompt: "your prompt here",
resolution: "4096x4096", // Higher resolution
styleWeight: 0.9, // Stronger style adherence
qualityPreset: "ultra", // Use quality preset
seed: 42 // Reproducible results
});
Issue: Export failures
# Robust export with fallback
def export_with_fallback(image_id, targets=['figma', 'adobe', 'local']):
for target in targets:
try:
result = client.export(
image_id=image_id,
target=target,
maintain_layers=True
)
print(f"Successfully exported to {target}")
return result
except Exception as e:
print(f"Failed to export to {target}: {e}")
continue
raise Exception("All export targets failed")
Issue: Rate limiting
// Implement rate limiting
import Bottleneck from 'bottleneck';
const limiter = new Bottleneck({
maxConcurrent: 5,
minTime: 1000 // 1 second between requests
});
const rateLimitedGenerate = limiter.wrap(async (prompt) => {
return await client.synthesize({ prompt });
});
// Use rate-limited function
const results = await Promise.all(
prompts.map(prompt => rateLimitedGenerate(prompt))
);
Issue: Memory errors with high resolution
# Generate in stages for very high resolution
def generate_high_res_safely(prompt, target_resolution=(8192, 8192)):
# Generate at lower resolution first
initial = client.synthesize(
prompt=prompt,
resolution=(2048, 2048),
variations=1
)
# Upscale progressively
current_id = initial['images'][0]['id']
intermediate_sizes = [(4096, 4096), (8192, 8192)]
for size in intermediate_sizes:
upscaled = client.upscale(
image_id=current_id,
target_resolution=size,
enhance_details=True
)
current_id = upscaled['id']
return current_id
Performance Optimization
// Cache generated designs
import NodeCache from 'node-cache';
const designCache = new NodeCache({ stdTTL: 3600 }); // 1 hour cache
async function cachedGenerate(prompt, options) {
const cacheKey = `${prompt}-${JSON.stringify(options)}`;
const cached = designCache.get(cacheKey);
if (cached) {
console.log('Returning cached result');
return cached;
}
const result = await client.synthesize({ prompt, ...options });
designCache.set(cacheKey, result);
return result;
}
Testing
// Unit test example
import { describe, it, expect } from 'vitest';
describe('AiPixelPerfect Integration', () => {
it('should generate design from prompt', async () => {
const result = await client.synthesize({
prompt: "test design",
variations: 2
});
expect(result.images).toHaveLength(2);
expect(result.images[0]).toHaveProperty('url');
expect(result.images[0]).toHaveProperty('id');
});
it('should validate prompts correctly', async () => {
const validation = await client.validatePrompt({
prompt: "Mickey Mouse logo",
checkCopyright: true
});
expect(validation.conflicts).toHaveLength.greaterThan(0);
});
});
Resources
- Repository: https://github.com/abnormal-codex/Ai-Pixel-Design-Archive
- Web Interface: https://abnormal-codex.github.io/Ai-Pixel-Design-Archive/
- API Documentation: Separate repository (link in main README)
- Community Support: GitHub Issues for feedback and bug reports
- License: MIT License