# stable-difussion-js

> Allows to create images from a given text using the stable-diffusion sdk

Latest version **1.0.3** (published 2022-09-01) · ISC license · 0 weekly downloads

## Install

```sh
npm install stable-difussion-js
pnpm add stable-difussion-js
yarn add stable-difussion-js
bun add stable-difussion-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.3 |
| Published | 2022-09-01 |
| First published | 2022-08-30 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 3 |
| Unpacked size | 6.6 KB |
| Known vulnerabilities | 0 (+1 in 1 direct dependencies) |
| Install scripts | no |
| Author | Luis Cruz |
| Maintainers | lcruga |
| Keywords | stable-difussion-js, stable-difussion, text2image, ai-image |

## Links

- npm: https://www.npmjs.com/package/stable-difussion-js
- Homepage: https://github.com/luiscruzga/stable-difussion-js#readme
- Issues: https://github.com/luiscruzga/stable-difussion-js/issues
- npm.io page: https://npm.io/package/stable-difussion-js

## Dependencies (3)

- [fs](https://npm.io/package/fs.md) ^0.0.1-security
- [path](https://npm.io/package/path.md) ^0.12.7
- [python-bridge](https://npm.io/package/python-bridge.md) ^1.1.0

## Alternatives

- [exif-parser](https://npm.io/package/exif-parser.md) — 3.8M weekly downloads
- [vite-plugin-compression](https://npm.io/package/vite-plugin-compression.md) — 569.5K weekly downloads
- [pica](https://npm.io/package/pica.md) — 442.4K weekly downloads
- [@reportportal/client-javascript](https://npm.io/package/@reportportal/client-javascript.md) — 408.8K weekly downloads
- [@tldraw/state](https://npm.io/package/@tldraw/state.md) — 316.0K weekly downloads

## Recent versions

- 1.0.3 (latest) — 2022-09-01
- 1.0.2 — 2022-08-30
- 1.0.1 — 2022-08-30
- 1.0.0 — 2022-08-30

## README

# Stable-difussion-js

Allows to create images from a given text using the stable-diffusion sdk




## Pre requirements

You must have python 3 previously installed, once you have python, you must install the stable-diffusion sdk and Pillow

```bash
  pip install stability_sdk Pillow
```

Additionally, you must have the API_KEY obtained from the [dreamstudio](https://beta.dreamstudio.ai/membership) website

## Installation

Install stable-difussion-js with npm

```bash
  npm install stable-difussion-js
```


## Usage/Examples

Create an image in base64 format

```javascript
const stableDiffusion = require('stable-difussion-js');
const SD = new stableDiffusion('YOUR_API_KEY_HERE');

// Get image in base64
SD.makeImage({
    search: 'a floating boat in a forest with studio ghibli style',
})
.then(data => {
    console.log('Image', data);
})
.catch(err => {
    console.log('Error', err);
})
```

Create an image with multiples API_KEY

```javascript
const stableDiffusion = require('stable-difussion-js');
const SD = new stableDiffusion(['YOUR_API_KEY_HERE', 'YOUR_API_KEY_2_HERE', 'YOUR_API_KEY_N_HERE']);

// Get image in base64
SD.makeImage({
    search: 'a floating boat in a forest with studio ghibli style',
})
.then(data => {
    console.log('Image', data);
})
.catch(err => {
    console.log('Error', err);
})
```

Create an image and store it locally

```javascript
const stableDiffusion = require('stable-difussion-js');
const path = require('path');
const SD = new stableDiffusion('YOUR_API_KEY_HERE');

// Get image in base64
SD.makeImage({
    search: 'a floating boat in a forest with studio ghibli style',
    outputPath: path.join(__dirname, 'img')
})
.then(data => {
    console.log('Image', data);
})
.catch(err => {
    console.log('Error', err);
})
```

Response

```javascript
{
  status: 'sucess',
  fileName: 'ff622f9af4da4e79a43eeb7806f48186.jpeg',
  file: 'PATH_TO_FILE\ff622f9af4da4e79a43eeb7806f48186.jpeg'
}
```

---
_Source: https://npm.io/package/stable-difussion-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
