png转换svg_转换SVG到PNG

png转换svg

Earlier this year I became obsessed with different types of media (images, audio, video) and how to convert and merge one format to/with another. Half of that obsessions is due to fascination in how its done, the other half is love of performance. A few of my favorites include:

今年早些时候,我迷上了不同类型的媒体(图像,音频,视频),以及如何将一种格式转换为另一种格式。 这种迷恋的一半是由于对方法的迷恋,另一半是对表演的热爱。 我最喜欢的一些东西包括:

Image format conversion and optimization tantalizes me the most because its usually a case of very little effort making a big difference, a la using image compression utilities like ImageOptim to turn a bloated image to an image half the size with little reduction in quality. The latest tool Ive found is , a Node.js utility for turning a SVG image into a static PNG!

图像格式转换和优化使我最着迷,因为通常情况下,只需很少的努力就可以发挥很大的作用,例如使用ImageOptim等图像压缩实用程序将ated肿的图像转换为一半大小的图像,而质量却几乎没有下降。 我发现的最新工具是 ,它是一个Node.js实用程序,用于将SVG图像转换为静态PNG!

require(svg2png)(dino.svg, dino.png, function(err) {
    if(err) {
	   console.log(An error occurred during conversion: , err);
   }
});

You can even perform scaling via another argument:

您甚至可以通过另一个参数执行缩放:

require(svg2png)(dino.svg, dino.png, 2.5, function(err) {
	if(err) {
        console.log(An error occurred during conversion and upscaling: , err);
    }
});

Heres a side by side comparison of the SVG and PNG:

这是SVG和PNG的并排比较:

A simple API, performs one function well -- what more can you ask for? I look forward to using this module to decrease the image sizes on each of the sites I work on!

一个简单的API可以很好地执行一个功能-您还需要什么? 我期待使用此模块来减少我工作的每个站点上的图像大小!

翻译自:

png转换svg

经验分享 程序员 微信小程序 职场和发展