Skip to content

Commit

Permalink
Apply suggestions from atjn
Browse files Browse the repository at this point in the history
Co-authored-by: Anton <dev@atjn.dk>
  • Loading branch information
styfle and atjn authored Sep 2, 2021
1 parent 202d0bc commit 3ea0d88
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions libsquoosh/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { cpus } from 'os';
const imagePool = new ImagePool(cpus().length);
```

This will create an image pool with an underlying processing pipeline that you can use to ingest and encode images. The ImagePool constructor takes one argument that defines how many parallel operations it is allowed to run at any given time. By default, this number is set to the amount of CPU cores available in the system it is running on.
This will create an image pool with an underlying processing pipeline that you can use to ingest and encode images. The ImagePool constructor takes one argument that defines how many parallel operations it is allowed to run at any given time.

## Ingesting images

Expand All @@ -29,10 +29,10 @@ You can ingest a new image like so:
```js
import fs from 'fs/promises';
const file = await fs.readFile('./path/to/image.png');
const image = imagePool.ingestImage(imagePath);
const image = imagePool.ingestImage(file);
```

The `ingestImage` function can accept any [ArrayBuffer](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer) whether that is from `readFile()` or `fetch()`.
The `ingestImage` function can accept any [`ArrayBuffer`][arraybuffer] whether that is from `readFile()` or `fetch()`.

The returned `image` object is a representation of the original image, that you can now preprocess, encode, and extract information about.

Expand Down

0 comments on commit 3ea0d88

Please sign in to comment.