Back

图片转换 image convert conversion mogrify

发布时间: 2022-08-04 02:03:00

svg -> png:

可以使用ffmpeg

更专业的是 inkscape

Dir.glob('*.svg').each do |file|
  puts "== processing file: #{file}"
  inkscape = '/mnt/d/softwares/Inkscape/bin/inkscape.exe'
  command = "#{inkscape} -o #{file.sub('.svg', '')}.png -w 1080 #{file}"
  `#{command}`
end

png -> jpg

mogrify -format jpg MY-PNG-FILE.png

Dir.glob('*.png').each do |file|
  puts "== processing file: #{file}"
  command = "mogrify -format jpg #{file}"
  `#{command}`
end

Back