Question

I have hundreds of .SVG files of size (256x256) which I want to change to, let's say, 48x48. I know that I can do it manually or with the help of Actions in Illustrator, but is there any script or better way that I can do it all at once?

1
2
12/15/2015 11:07:00 PM

Accepted Answer

This is a "hacky" way of doing it (if you are not a coder), but since you are looking for alternative solutions, here we go.

SVG is an XML based format. This means that you can edit the SVG (carefully) as regular text just like you would edit a web page. You could then use the text editing functionalities of your favourite text or web editor (such as "replace in all open files") to make bulk changes.

One of the things you can edit is the ViewPort (think canvas) dimensions of the SVG. You specify the size of the viewport using the width and height attributes of the <svg> element. You could try this:

  1. Open your SVG in a text editor. For example, in Notepad or Notepad++ in Windows. You can also use any HTML editor.
  2. Don't get overwhelmed by the code. Just take a look at the <svg> element the beginning of the code. Check if it has the width and height attributes. In this case, for example, my SVG has width and height set to 100%:

enter image description here

  1. Change (or add) the width and height attributes to whatever you want t to be. In you case 256. pixels are the default unit so don't change it to "256px", just plain "256". Here is where you could use the "replace" functionality of your text editor to replace the value in a bunch of files at the same time.

enter image description here

For more about the Viewport, just google it. It is very well documented.

6
11/27/2015 3:58:00 PM

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow


Website under construction!!!
^