Reputation: 1268
I've been looking for a solution to optimize images for better performance.
After trying some solutions (like sharp and imagemin, which resulted in never smaller, sometimes bigger files), I am now looking to experiment with Google's pagespeed. Unfortunately, pagespeed seems to only support Apache and Nginx, which I would not like to add to my stack just for image optimization (also, I would prefer making the optimization once on upload, and not on server request, even if cached).
I will be very grateful for any information that might help me implement this in native node.js, and for any other (working!) image optimization recommendations.
Upvotes: 5
Views: 777
Reputation: 1662
Try npm module lwip.
It's a standalone library(re-built when installing) and no runtime dependencies.
I use its resize and scale operations to create thumb images in my file service project.
Check if this is what you need. :)
Upvotes: 1
Reputation: 2154
I suggest you only use node for dynamic content (e.g: your application server logic).
For static content, such as images, stylesheets and others... just serve them with a regular web server like nginx. There you can use ngx_pagespeed.
Upvotes: 3