
Image manipulation in JavaScript is done using the canvas element. Imagine this with operations like undo/redo and complex text and image overlays. If a user is manipulating a heavy image, it will take a lot of time to download transformed images from the server. The speed is critical for the user in these editors.

This approach also saves data while transmitting images from the server to the client. And it is supported by all browsers.įirst we will create a new project in Node.Image resizing is computationally expensive and usually done on the server-side so that right-sized image files are delivered to the client-side. The image format that we are going to use in this example is WebP, which offers compression greater than png and jpg, which helps to load web pages more quickly.

Sharp is a module for Node.js to convert images of the most diverse formats and varied dimensions to a smaller size, without having to worry about the color space, channels and alpha transparency, because all of these are treated correctly. By combining Express.js with multer, we will be able to easily implement the file upload feature. Multer is a middleware for handling multipart/form-data that is mainly used to upload files. Nowadays uploading images is one of the most basic operations of all applications. Today I'm going to focus on multer and sharp. I don't think I need to talk about Express.js because everyone who uses Node.js has used this framework at some point. However, I will show that with a simple Express.js api we can upload an image, change the Mime Type and still decrease its size. One of the most common is to compress images. Currently, I feel that the market is increasingly oriented towards the use of third-party services to make part of our pipeline.
