Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

node.js image compression

I'm looking for a node.js module.

A node.js module that I can use to serve compressed images of the sort by the smushit service.

Is there such a module?

Thanks

like image 286
Mark Avatar asked Aug 16 '11 05:08

Mark


People also ask

How do I reduce the size of an image in node JS?

NodeJS – Resize() is an inbuilt function that is used to resize the images to the desired size. We can use resize to set the height and width using a 2-pass bilinear algorithm. It can resize an image into any size as declared by the user. We can take input from the user or resize it into fixed Width*Height size.

What is sharp node JS?

sharp is a popular Node. js image processing library that supports various image file formats, such as JPEG, PNG, GIF, WebP, AVIF, SVG and TIFF. In this tutorial, you'll use sharp to read an image and extract its metadata, resize, change an image format, and compress an image.

How do I compress an image in react?

To compress your images follow these three simple steps: Install the package using npm/yarn. Add the particular code block to your project. Be Amazed!


2 Answers

maybe you can use imagemin

github:https://github.com/imagemin/imagemin

It can work.

like image 104
tobeyouth Avatar answered Nov 16 '22 01:11

tobeyouth


I switched from gm to https://github.com/lovell/sharp for better performance.

like image 32
Robert Claypool Avatar answered Nov 16 '22 01:11

Robert Claypool