1.0.1-z.9 • Published 2 years ago
@arugaz/ai2d v1.0.1-z.9
Table of Contents
Features
- Generate a hyper-realistic photo an anime style
Install
$ npm install --save @arugaz/ai2d
$ yarn add @arugaz/ai2dBefore use this package, You have to add sharp or jimp to dependencies.
Usage
import AI2D from "@arugaz/ai2d";
await AI2D(`Buffer | Base64 | Url | Path`, options);
// default
await AI2D("https://nekopoi.care/image.png"); //=> Buffer
// crop
await AI2D("https://nekopoi.care/image.png", {
crop: "SINGLE", // SINGLE | COMPARED
}); //=> Buffer
// proxy
await AI2D("https://nekopoi.care/image.png", {
proxy: "socks5://11.22.33.44:1234" // support https & socks
}); //=> Buffer
// with async-retry opts
await AI2D("https://nekopoi.care/image.png", {
crop: "COMPARED",
retries: 100,
factor: 3,
randomize: false,
}); //=> BufferOptions
The options are
crop: COMPARED | SINGLE. Default didnt crop the image.proxy: Your URL Proxy, support https or socks proxyretries: The maximum amount of times to retry the operation. Default is10.factor: The exponential factor to use. Default is1.minTimeout: The number of milliseconds before starting the first retry. Default is1000.maxTimeout: The maximum number of milliseconds between two retries. Default isInfinity.randomize: Randomizes the timeouts by multiplying with a factor between1to2. Default istrue.onRetry: an optionalFunctionthat is invoked after a new retry is performed. It's passed theErrorthat triggered it as a parameter.forever: Whether to retry forever.unref: Whether to unref the setTimeout's.
Tldr
From
December 6toDecember 15the AI had been available only inChinaor withChinese proxies. SinceDecember 16the AIworksfor the rest of the world (UPD: still doesn't work in some countries) again so using proxies is not needed anymore, but it's limited and allows you to generate only one type of media. Seems likeit's impossibleto findFREE alive proxies. Don't waste your time searching andjust buy itsomewhere.