png转换svg_转换SVG到PNG

矫情吗;* 2023-02-21 14:27 27阅读 0赞

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 it’s done, the other half is love of performance. A few of my favorites include:

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

  • Resize an Animated GIF

    调整动画GIF的大小

  • Combine Audio and Video with ffmpeg

    将音频和视频与ffmpeg结合

  • Create an Image Preview from a Video

    从视频创建图像预览

  • Convert Video to GIF or GIF to Video

    将视频转换为GIF或将GIF转换为视频

  • Get the First Frame of an Animated GIF with ImageMagick

    使用ImageMagick获取动画GIF的第一帧

Image format conversion and optimization tantalizes me the most because it’s 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 I’ve found is svg2png, a Node.js utility for turning a SVG image into a static PNG!

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

  1. require('svg2png')('dino.svg', 'dino.png', function(err) {
  2. if(err) {
  3. console.log('An error occurred during conversion: ', err);
  4. }
  5. });

You can even perform scaling via another argument:

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

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

Here’s 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可以很好地执行一个功能-您还需要什么? 我期待使用此模块来减少我工作的每个站点上的图像大小!

翻译自: https://davidwalsh.name/convert-svg-png

png转换svg

发表评论

表情:
评论列表 (有 0 条评论,27人围观)

还没有评论,来说两句吧...

相关阅读