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

upscayl-node

v1.4.6

Published

Upscale node package based on upscayl

Downloads

664

Readme

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

| Property | Description | Type | Default | -------- | ----------- | ---- | ------- | model | Absolute path of the model used to upscale the image. | string | upscaler.getModels()[0] | scale | Specifies the scale of the resulting image relative to the original image. | number | 2 | compression | Set the final image compression. | number | 0 | tileSize | Define the final tile size of the image. | number | 0