4

I have a folder (original_svg_files) with more than ten thousand .svg files in different sizes and I need to resize each one of them. The name should be the same with the original .svg file and the longest side should be 150px and I also need to keep the aspect ratio (constrain the proportions).

I tried to use Adobe Illustrator to do that but can't figure out how since it supports only transformation via a percentage. I need to automate this process by the command line or Automator since what I am doing now is really time consuming!

I am using OS X El Capitan version 10.11.1.

Any suggestions?

2

Looks like the -fit option on this command line utility will do exactly what you want:

https://github.com/vieron/svg-resizer

If you need help with brew, look here: http://coolestguidesontheplanet.com/installing-homebrew-os-x-yosemite-10-10-package-manager-unix-apps/

If your not comfortable with the command line, don't let it intimidate you - it's really not that hard. Post back if you get stuck or something just doesn't make sense.

0

I'm pretty sure you can use ImageMagick to do what you need. There is a homebrew package for Imagemagick (homebrew is the Mac equivalent of apt-get). So after a quick:

brew install imagemagick

You should be able to use the command line utilities for it. Looks like the convert command should do the resizing with the proportional scaling that you want.

convert oldimage.svg -resize "150>" oldimage.svg

This command says to shrink the image so that the longest side is 150. The rest is just using standard shell scripting to get the desired effect.

  • This broke the SVG format for me. It adds xml and doctype tags and the image no longer displays properly in a web browser. – poshaughnessy Jul 31 '17 at 21:46
  • this rasterizes the svg – hellocatfood Jul 13 '18 at 22:48

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .