profile-picture-generator-ai
v1.0.0
Published
AI-powered profile picture generator using Google Gemini. Generate professional, anime, cartoon, and artistic avatars in seconds.
Maintainers
Readme
Profile Picture Generator
An AI-powered profile picture generator for Node.js. Generate professional headshots, anime avatars, cartoon portraits, and more — right from your terminal or JavaScript code. Powered by PFPMaker.
Features
- Generate AI profile pictures from a text description
- 10 built-in art styles: professional, anime, cartoon, artistic, minimal, realistic, fantasy, cyberpunk, watercolor, pixel
- Save output as PNG directly to disk
- Simple CLI — works with
npx, no install required - Clean JavaScript API for use in your projects
- Zero production dependencies
- Node.js 14+
Quick Start
npx profile-picture-generator --prompt "smiling developer with glasses" --style professional --output avatar.pngYou'll need a free Gemini API key to use this tool.
Installation
# Run without installing (recommended)
npx profile-picture-generator --help
# Install globally
npm install -g profile-picture-generator
# Install locally in your project
npm install profile-picture-generatorCLI Usage
generate-pfp [options]Options
| Flag | Description | Default |
|------|-------------|---------|
| --prompt <text> | Description of your profile picture | "professional profile picture" |
| --style <name> | Art style to apply | professional |
| --output <file> | Output file path | profile-picture.png |
| --apiKey <key> | Your Gemini API key | GEMINI_API_KEY env var |
| --styles | List all available styles | — |
| --help | Show help | — |
CLI Examples
# Professional headshot
generate-pfp --prompt "confident software engineer" --style professional --output headshot.png
# Anime avatar
generate-pfp --prompt "young woman with short hair" --style anime --output anime-avatar.png
# Fantasy character
generate-pfp --prompt "wise old wizard with a long beard" --style fantasy --output wizard.png
# Set API key via environment variable (recommended)
export GEMINI_API_KEY=your_key_here
generate-pfp --prompt "friendly cartoon fox" --style cartoonAPI Usage
const ProfilePictureGenerator = require('profile-picture-generator');
const generator = new ProfilePictureGenerator({
apiKey: process.env.GEMINI_API_KEY, // or pass your key directly
});
// Generate and save to file
const image = await generator.generate({
prompt: 'smiling woman with red hair',
style: 'professional',
output: 'avatar.png', // optional: saves automatically
});
// Or save manually
await generator.saveToFile(image, 'avatar.png');
// Or get a data URI for use in HTML/CSS
const dataURI = generator.toDataURI(image);
console.log(dataURI); // data:image/png;base64,...Constructor Options
| Option | Description | Default |
|--------|-------------|---------|
| apiKey | Required. Your Google Gemini API key | — |
| model | Gemini model to use | gemini-2.0-flash-preview-image-generation |
generate(options) Options
| Option | Description | Default |
|--------|-------------|---------|
| prompt | Text description of the image | "profile picture of a person" |
| style | Style key (see table below) | professional |
| output | File path to save the PNG | null (no auto-save) |
Return Value
generate() returns a Promise resolving to:
{
data: string, // Base64-encoded image data
mimeType: string, // e.g. "image/png"
}Available Styles
| Style | Description |
|-------|-------------|
| professional | Corporate headshot, neutral background, formal attire |
| anime | Anime-style with vibrant colors and expressive eyes |
| cartoon | Bold outlines, fun colors, friendly expression |
| artistic | Painterly brushstroke portrait, gallery quality |
| minimal | Flat illustration, geometric, limited palette |
| realistic | Photorealistic, soft natural lighting |
| fantasy | Epic fantasy character, ornate details, dramatic lighting |
| cyberpunk | Neon accents, futuristic aesthetic, dark background |
| watercolor | Soft watercolor painting, pastel tones |
| pixel | 16-bit pixel art, retro game style |
List all styles from the CLI:
generate-pfp --stylesFull API Example
const ProfilePictureGenerator = require('profile-picture-generator');
async function main() {
const generator = new ProfilePictureGenerator({
apiKey: process.env.GEMINI_API_KEY,
});
// List available styles
console.log('Styles:', ProfilePictureGenerator.styles);
// Generate multiple avatars
const styles = ['professional', 'anime', 'cyberpunk'];
for (const style of styles) {
console.log(`Generating ${style} avatar...`);
await generator.generate({
prompt: 'young developer with a friendly smile',
style,
output: `avatar-${style}.png`,
});
}
console.log('Done!');
}
main().catch(console.error);Getting a Gemini API Key
- Go to Google AI Studio
- Sign in with your Google account
- Click Get API Key → Create API key
- Copy the key and use it via
--apiKeyor theGEMINI_API_KEYenvironment variable
The free tier is generous and sufficient for personal use.
License
MIT
About
Want a no-code, web-based profile picture generator? Check out PFPMaker — an AI profile picture tool that requires no setup.
