Mark
Mark

Reputation: 33671

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

Upvotes: 15

Views: 55282

Answers (9)

Oliver Dixon
Oliver Dixon

Reputation: 7424

Sharp.

  • Supports TypeScript
  • Simple easy to use API

Code

await sharp(file.path)
         .resize(600, 600)
         .toFile(file.path + '_compress')

Upvotes: 2

Chetan pawar
Chetan pawar

Reputation: 28

for compression of image compress-image package is also good option https://www.npmjs.com/package/compress-images

Upvotes: 0

Robert Claypool
Robert Claypool

Reputation: 4312

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

Upvotes: 5

     Юрий Светлов
Юрий Светлов

Reputation: 1750

Detected path and can use combination compressing. SVG JPG PNG GIF

https://www.npmjs.com/package/compress-images

Upvotes: 1

Simran
Simran

Reputation: 2830

Try this library jimp for node js

Upvotes: 1

tobeyouth
tobeyouth

Reputation: 430

maybe you can use imagemin

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

It can work.

Upvotes: 21

cleversprocket
cleversprocket

Reputation: 1391

For anyone googling this, GraphicsMagic is hosted on NPM as gm: https://www.npmjs.org/package/gm

Upvotes: 4

sam100rav
sam100rav

Reputation: 3783

You can use GraphicsMagick for node.js.

Upvotes: 2

Alfred
Alfred

Reputation: 61793

Maybe https://github.com/bentruyman/pulverizr?

Upvotes: 5

Related Questions