nodejs压缩图片有什么方法呢?

tinify 这个我看网上都说一个月只能压缩500次,超出要收费

有没有开源的压缩图片的 node包呢

阅读 765
评论
    3 个回答
    • 12.1k

    我觉得还是看需求吧。首先我们使用 sharp 安装没遇到什么问题;其次我建议先试试 webp。

        • 2.2k

        sharp

        The typical use case for this high speed Node.js module is to convert large images in common formats to smaller, web-friendly JPEG, PNG and WebP images of varying dimensions.

        Resizing an image is typically 4x-5x faster than using the quickest ImageMagick and GraphicsMagick settings due to its use oflibvips.

        Colour spaces, embedded ICC profiles and alpha transparency channels are all handled correctly. Lanczos resampling ensures quality is not sacrificed for speed.

        As well as image resizing, operations such as rotation, extraction, compositing and gamma correction are available.

        Most modern macOS, Windows and Linux systems running Node.js v10+ do not require any additional install or runtime dependencies.

          撰写回答

          登录后参与交流、获取后续更新提醒