Skip to content
/ aimg Public

🧑‍🎨 A Node.js CLI for generating AI images with Replicate and saving them to disk.

Notifications You must be signed in to change notification settings

zeke/aimg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aimg

A Node.js CLI for generating AI images with Replicate and saving them to disk.

screenshot

Features

  • Easy to install and use.
  • Supports multiple models like Flux and SD3. Default is Flux Schnell.
  • Saves all the files to disk for you.
  • Includes prediction id and a slug of the prompt in the filename.
  • Lets you specify an exact prompt, or specify a subject and roll the dice with random promptmaker prompts.

Installation

npm i -g aimg

The grab a Replicate API token and set it in your environment:

export REPLICATE_API_TOKEN="r8_..."

Usage

All that is required is a prompt:

aimg "cute cat"

This will generate three images of a cute cat and save them to the current directory.

Long prompt

If your prompt is long, you can put it in a file:

aimg "$(cat prompt.md)"

Different model

The default model is Flux Schnell, the new state-of-the-art image generation model for the creators of Stable Diffusion.

If you want to use a different model, specify it with the --model option. Here's an example using SD3:

aimg "cute cat" --model "stability-ai/stable-diffusion-3"

More images

If you want more images, use the --count option:

aimg "cute cat" --count 20

Random prompts

If you want generate a different semi-random prompt for each image, specify a subject and it will use promptmaker to generate random prompts:

aimg --subject "a white cat"

If you specify a subject, then prompt is ignored.

Output directory

If you want to save the images to a specific directory, use the --outputdir option:

aimg "pink cat" --outputdir "pink-cat"

Kitchen sink

Hee's an example that loads a prompt from a file, generates 100 images with random "pink cat" prompts, and stuffs them in a specific directory:

aimg --subject "pink cat" --count 100 --outputdir "pink-cat"

Options

About

🧑‍🎨 A Node.js CLI for generating AI images with Replicate and saving them to disk.

Resources

Stars

Watchers

Forks

Packages

No packages published