Inkscape.org
Beginners' Questions Batch resize SVGs in a folder
  1. #1
    meetdilip meetdilip @meetdilip

    I have some Google Material Design icons in a folder. Around 100 of them in a folder. They are very small, the canvas is only 24x24 px. I got Inkscape installed and can resize them one by one. But there is a total of 1000 + SVGs and resizing them one by one will take ages.

    It would be great if someone can help me batch resize the content of each folder ( around 10 folders altogether). I am trying to resize to 48px or 64 px size. Thanks.

    PS : I am using 18.04 Ubuntu.

  2. #2
    Tyler Durden Tyler Durden @TylerDurden

    I would try using a text editor like gedit to make an update across documents using find/replace:

    These replacements change the viewbox (page size) and adds a group wrapper around all the paths and applys a scale transform to the group.

    FIND: height="24" viewBox="0 0 24 24" width="24">
    REPLACE WITH: height="48" viewBox="0 0 48 48" width="48"><g transform="scale(2)">
    
    FIND: </svg>
    REPLACE</g></svg>

    I tried it with a few Google Material icons and it seemed to work in a browser and Inkscape. I don't know if your destination will allow transforms or groups, but  I think it's valid SVG.

    You would also need a batch file renaming utility like Thunar to update the filenames to indicate the new sizes.

     

     

    Have a nice day.

    TD

    Accessibility 24Px
    Accessibility 48Px
  3. #3
    meetdilip meetdilip @meetdilip
    *

    Thanks @TylerDurden

    How can I open all the files in the folder at the same time using Gedit ? Or, do I have to do it one by one ?

     

    Edit:

    It works, but not sure to resize as a batch

     

     

    Screenshot From 2020 02 03 16 38 38
  4. #4
    Tyler Durden Tyler Durden @TylerDurden

    I would use the gedit advanced find replace plugin, but it's not loading for me on my Mint system. :(  Maybe you will have better luck installing the plugin.

    There are other linux text editors that replace across documents, maybe try Atom.

    For renaming, you migh try: http://ivanrf.com/en/portfolio-posts/massive-file-renamer/

    TD

  5. #5
    meetdilip meetdilip @meetdilip

    Thanks. I will try :)