首页 > 其他分享 >sharp

sharp

时间:2023-12-26 16:46:50浏览次数:26  
标签:use License image JPEG images sharp PNG

sharp

sharp logo

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

It can be used with all JavaScript runtimes that provide support for Node-API v9, including Node.js >= 18.17.0, Deno and Bun.

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

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 do not require any additional install or runtime dependencies.

Formats

This module supports reading JPEG, PNG, WebP, GIF, AVIF, TIFF and SVG images.

Output images can be in JPEG, PNG, WebP, GIF, AVIF and TIFF formats as well as uncompressed raw pixel data.

Streams, Buffer objects and the filesystem can be used for input and output.

A single input Stream can be split into multiple processing pipelines and output Streams.

Deep Zoom image pyramids can be generated, suitable for use with "slippy map" tile viewers like OpenSeadragon .

Fast

This module is powered by the blazingly fast libvips  image processing library, originally created in 1989 at Birkbeck College and currently maintained by a small team led by John Cupitt .

Only small regions of uncompressed image data are held in memory and processed at a time, taking full advantage of multiple CPU cores and L1/L2/L3 cache.

Everything remains non-blocking thanks to libuv, no child processes are spawned and Promises/async/await are supported.

Optimal

The features of mozjpeg and pngquant can be used to optimise the file size of JPEG and PNG images respectively, without having to invoke separate imagemin processes.

Huffman tables are optimised when generating JPEG output images without having to use separate command line tools like jpegoptim  and jpegtran .

PNG filtering is disabled by default, which for diagrams and line art often produces the same result as pngcrush .

The file size of animated GIF output is optimised without having to use separate command line tools such as gifsicle .

Contributing

guide for contributors  covers reporting bugs, requesting features and submitting code changes.

Licensing

Copyright 2013 Lovell Fuller and others.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.apache.org/licenses/LICENSE-2.0 

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

标签:use,License,image,JPEG,images,sharp,PNG
From: https://www.cnblogs.com/sexintercourse/p/17928469.html

相关文章

  • [CSharpTips]C# 设置应用程序开机自启动
    C#设置应用程序开机自启动主要是通过动态生成vbs脚本,放置在系统自启动目录下,系统开机时会自动执行vbs脚本启动应用程序开机自启动,自动生成vbs脚本 using(StreamWriterfile=newStreamWriter($@"{Environment.GetFolderPath(Environment.SpecialFolder.Startup)}\StartU......
  • .Net 8与硬件设备能碰撞出怎么样的火花(使用ImageSharp和Protobuf协议通过HidApi与设备
    前言本人最近在社区里说想做稚晖君的那个瀚文键盘来着,结果遇到两个老哥一个老哥送了我电路板,一个送了我焊接好元件的电路板,既然大家这么舍得,那我也就真的投入制作了这把客制化键盘,当然我为了省钱也是特意把外壳模型重新切割,用3D打印机打印了整个外壳,不得不说省了八九百的CNC费用......
  • 大华摄像头应用opencvsharp进行实时监控、监控录像保存和播放
    1.配置大华摄像机参数 检查RTSP端口号 修改分辨率,在这里我们主要设置【辅码流】大华RTSP协议解释访问主码流rtsp://admin:[email protected]:554/cam/realmonitor?channel=1&subtype=0访问辅码流rtsp://admin:[email protected]:554/cam/realmonitor?cha......
  • [CSharpTips]C# 控制台程序屏蔽关闭按钮,关闭快速编辑模式,注册关闭事件
    C#控制台程序屏蔽关闭按钮,关闭快速编辑模式,注册关闭事件usingSystem;usingSystem.Collections.Generic;usingSystem.Diagnostics;usingSystem.IO;usingSystem.Linq;usingSystem.Runtime.InteropServices;usingSystem.Text;usingSystem.Threading;usingSystem.......
  • SixLabors.ImageSharp 圆角矩形路径代码
    原因因微软抛弃了System.Drawing.Common决定重写绘图底层,在学习绘制时常会用到部分绘图引擎,参考过几个都有缺陷例如:1.SkiaSharp字体布局问题参考布局问题2.opencvsharp不支持中文文字于是乎我就用到了imageSharp,其中看到作者有对于圆角矩形头像的示例代码,但这......
  • CSharp: weather
     usingSystem;usingSystem.Collections.Generic;usingSystem.Linq;usingSystem.Text;namespaceModel{///<summary>///高德天气///</summary>publicclassAMapWeatherInfo{publicstringstatus{get;set;}......
  • nodejs 基于sharp + smartcrop 实现图片的智能提取排版
    属于一个简单的demo示例,主要是学习下sharp包对于图片的处理,以及基于smartcrop.js实现智能图片抠图结合sharp提供的图片组合能力,实现一个基于模版的图片组合,代码很简单简单任务描述就是有一个图片,我们需要智能的提取核心信息,并生成一个确定大小的图片,然后基于将生成的图片填充......
  • SkiaSharp库在NetCore下跨平台图片操作基础使用方法
    SkiaSharp库在NetCore下跨平台图片操作基础使用方法:在跨平台开发中,处理图片是一项常见的需求。而SkiaSharp库是一个强大的工具,它提供了在NetCore平台下进行跨平台图片操作的能力。本文将介绍SkiaSharp库在NetCore下的基础使用方法,以及逐步深入的高级功能。什么是SkiaSharp?SkiaS......
  • NetCore使用SkiaSharp库对给定路径的图片进行大小缩放,要适当考虑等比率缩放,以高度为准
    SkiaSharp库是跨平台的2D图片操作库,在夸平台方面比较稳定,且支持常用的“windows操作”:缩放,剪裁,格式转换等。例如:如果要按照原始图片高度为准,自动调整宽度进行等比例缩放,可以根据以下步骤使用SkiaSharp库进行操作:导入SkiaSharp命名空间:usingSkiaSharp;加载原始图像:str......
  • CSharp: vs 2022
    package.json {"name":"healthcheck","version":"0.0.0","scripts":{"ng":"ng","start":"echoStarting...&&ngserve","build&......