npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

aimg

v2.2.0

Published

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

Downloads

217

Readme

aimg

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

screenshot

Features

  • Easy to install and use.
  • Supports any model on Replicate that has a prompt input. 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.
  • Automatically adds MediaProvenance EXIF metadata to the downloaded image files so you have a record of the model, input, output, etc.

Installation

npm i -g aimg

Then 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, but you can specify any model with the --model option.

aimg "cute cat" --model bytedance/sdxl-lightning-4step

This will work for any model on Replicate that takes a prompt as input and outputs a list of URLs.

Examples:

The latest version of the model is used unless you specify a version in the format {owner}/{name}:{version}:

aimg "cute cat" --model zeke/ziki-flux:dadc276a9062240e68f110ca06521752f334777a94f031feb0ae78ae3edca58e

More images

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

aimg "cute cat" --count 20

Extra flags as inputs to the model

Any extra flags you pass will be passed along to the model as input. For example, if the model takes an output_format input, you can pass it like this:

aimg "cute cat" --output_format jpg

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