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

remige

v0.1.1

Published

Remige is a forked version of libSquoosh, integrating Squoosh's image codecs directly into your JavaScript applications. This fork ensures continued support and enhancements, compatible with the latest Node.js versions for optimal performance in modern de

Downloads

24

Readme

Description

Remige is a forked version of libSquoosh, integrating Squoosh's image codecs directly into your JavaScript applications. This fork ensures continued support and enhancements, compatible with the latest Node.js versions for optimal performance in modern development environments.

Compatibility

Remige supports the latest Node.js versions, ensuring compatibility and optimal performance in modern development environments.

Why Forked?

With ongoing updates and improvements, Remige serves developers seeking robust image compression solutions within their JavaScript projects. It maintains functionality and reliability for current development practices.

Installation

Install Remige in your local project with:

$ npm install remige

To use Remige, import ImagePool and set up your image processing pipeline:

import { ImagePool } from "remige";
import { cpus } from "os";

const imagePool = new ImagePool(cpus().length);

Ensure to only create one ImagePool instance to avoid memory issues during parallel image processing.

Ingesting Images

Ingest images using imagePool.ingestImage(), accepting ArrayBuffer from fs.readFile() or fetch().

import fs from "fs/promises";

const file = await fs.readFile("./path/to/image.png");
const image = imagePool.ingestImage(file);

Preprocessing and Encoding Images

Preprocess and encode images to various formats:

const preprocessOptions = {
  resize: {
    width: 100,
    height: 50,
  },
};

await image.preprocess(preprocessOptions);

const encodeOptions = {
  mozjpeg: {}, // default settings
  jxl: {
    quality: 90,
  },
};

const result = await image.encode(encodeOptions);

Closing ImagePool

Close the ImagePool pipeline to prevent ingesting and encoding new images:

await imagePool.close();

Writing Encoded Images to File System

Write encoded images to the file system:

const rawEncodedImage = image.encodedWith.mozjpeg.binary;

await fs.writeFile("/path/to/new/image.jpg", rawEncodedImage);

Extracting Image Information

Extract decoded and encoded image information:

console.log(await image.decoded);
console.log(image.encodedWith.jxl);

Auto Optimizer

Remige includes an experimental auto optimizer:

const encodeOptions = {
  mozjpeg: "auto",
};