Jump to content

Recommended Posts

Posted

I'd like to know the most efficient way to resize (proportionally) a bunch of SVG files that I created in Affinity designer, but this time using a more appropriate document layout size (still as SVG file).   I think I need to "export", in order to keep everything proportional.  I have each image saved as a separate SVG file (didn't use an artboard or anything).  Is there a way to batch or otherwise streamline the process, of what I'm trying to accomplish?  

Posted

Open the file in a text editor and change the width/height values
eg
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="100%" height="100%"

to
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg width="75%" height="75%"
<svg width="200%" height="200%" whatever

I only use svg's on the web so I have never needed to do this any resizing being done with css. If you state what you are using the resized files for then you may get a more informed answer

To batch the process you could write a Powershell script or a Notepad++ macro. Good luck

Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe
Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10

Posted

Thank you!  I want to copy and paste the SVG's into a fort making app and its hard to resize (resize by a lot) manually within the app, plus then also the need to re-proportion widths, which is just a mess.  I guess I was hoping that there would be an efficient way to do this from within Affinity.  I found that I can EXPORT files, into different SVG files with differnet  dimensions, via Affinity, but only one at a time.  In trying to research this myself, I also have the impression that sometimes, at least some means of resizing, might produce some kind of unwanted effects (maybe I misunderstood). My images are pretty simple, so maybe less to mess up and I don't think I've had issues with using the export feature in Affinity Designer, I just wish that I could batch the process in Affinity Designer - also I use a mac, if that helps).  

Posted

Here's a Powershell script that will produce svg's with three different sizes, it's straightforward to extend this to many more as long as you speak Powershell which can be a bit of a struggle. Powershell is a Windows thing but now available for the mac and linux

ReplaceString.ps1

Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe
Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10

Posted
18 minutes ago, David in Яuislip said:

Here's a Powershell script that will produce svg's with three different sizes

49 minutes ago, SangieM said:

also I use a mac, if that helps

The OP on a Mac can instead easily use the "sed" or "perl" cli tools from inside of Terminal.app to change in a bunch of SVG xml text files the size settings, or their viewbox settings accordingly. So that would be the OS based batch processing of SVG changes in files then.

Quote
perl -pi -w -e 's/SEARCH_FOR_TXT/REPLACE_WITH_TXT/g;' *.svg

... OR ...

Quote

sed -i "" "s/SEARCH_FOR_TXT/REPLACE_WITH_TXT/g" *.svg

... and so on.

Other than that I also generally recommend to also read the following about SVG scaling ...

☛ Affinity Designer 1.10.8 ◆ Affinity Photo 1.10.8 ◆ Affinity Publisher 1.10.8 ◆ OSX El Capitan
☛ Affinity V2.3 apps ◆ MacOS Sonoma 14.2 ◆ iPad OS 17.2

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.