1.4.6 • Published 12 months ago

upscayl-node v1.4.6

Weekly downloads
-
License
AGPL-3.0
Repository
github
Last release
12 months ago

Upscayl Node

Upscayl node prepares the UPSCAYL CORE to run in NodeJS.

const { join } = require("path");
const { upscaler } = require("upscayl-node");

const run = async () => {
  await upscaler.init();

  const outputImagePath = await upscaler.upscaleImage(
    join(__dirname, "./image-test.png"),
    join(__dirname, "./image-test-result.png")
  );
};

run();

Upscayl definition:

| Free and Open Source AI Image Upscaler

Upscayl lets you enlarge and enhance low-resolution images using advanced AI algorithms. Enlarge images without losing quality. It's almost like magic! 🎩🪄

Original repo: https://github.com/upscayl/upscayl

Installation

This is a Node.js module available through the npm registry.

Before installing, download and install Node.js.

If this is a brand new project, make sure to create a package.json first with the npm init command.

Installation is done using the npm install command:

$ npm install upscayl-node

API reference

Methods

upscaler.init(): Promise<"void">

This method allows you to load the default AI models.

upscaler.getModels(): model[]

This method allows you to obtain the path of the models. It is useful if you want to change the default model that upscales the image.

upscaler.addModel(model: Model): Model

This method allows you to add a path where you have a custom model to the list of models.

upscaler.upscaleImage(imagePath, imageOutputPathd, options?): Promise<"string">

This method allows you to upscale an image with various custom options.

const { join } = require("path");
const { upscaler } = require("upscayl-node");

const run = async () => {
  // You have to init it.
  // Note: the init method lets you to load AI models
  await upscaler.init();

  // Once we have the upscaler with models loaded we can run it
  const outputImagePath = upscaler.upscaleImage(
    join(__dirname, "./image-test.png"),       // Absolute path from image to be upscaled
    join(__dirname, "./image-test-result.png") // Absolute path from image upscaled
  );
};

run();

imagePath

Absolute image path of the image to be upscaled. Only png, jpg or webp images are accepted.

imageOutputPath

Absolute image path of the resulting image. You can choose a different image extension, which will change the image format of the original if you wish. Only png, jpg or webp are allowed.

options

PropertyDescriptionTypeDefault
modelAbsolute path of the model used to upscale the image.stringupscaler.getModels()0
scaleSpecifies the scale of the resulting image relative to the original image.number2
compressionSet the final image compression.number0
tileSizeDefine the final tile size of the image.number0
1.4.6

12 months ago

1.4.5

12 months ago

1.4.4

1 year ago

1.4.3

1 year ago

1.4.2

1 year ago

1.4.1

1 year ago

1.4.0

1 year ago

1.3.1

1 year ago

1.3.0

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago