Jump to content
rubs

Several SVG export bugs

Recommended Posts

Hi,

 

I found the following problems when exporting SVGs:

 

 

  • Opacity values are changed. E.g. 0.3 becomes 0.298039, 0.65 becomes 0.647059, etc.
  • In paths, precisely positioned nodes are not exported with much precision. E.g. 14 becomes 14.001, 13 becomes 12.999, 0 becomes -0.001, etc.
  • Some rectangles are exported as paths instead of rects
  • AD doesn't memorize settings and the chosen preset between exports. I believe these should be memorized between exports and even saved with the document
  • AD crashed when I created a preset name with a hyphen in it. Can't reproduce it again.
  • Sometimes objects are exported with the wrong size. I believe this happens if you change the DPI setting before choosing an SVG preset, but I didn't test it enough to be sure.

 


I'm not sure if these problems are Windows-specific or not, so please feel free to move this topic elsewhere if it is the case.

 

Share this post


Link to post
Share on other sites

I've discovered an SVG issue as well - if you open an SVG file in Affinity, and then try to 'save as' it as a affinity file it saves it as an SVG anyway and the resulting file is corrupt and unopenable.

Share this post


Link to post
Share on other sites

Hi rubs,

I will look into these shortly - would you be able to attach the document that contains rectangles getting exported as paths please?

 

 

I've discovered an SVG issue as well - if you open an SVG file in Affinity, and then try to 'save as' it as a affinity file it saves it as an SVG anyway and the resulting file is corrupt and unopenable.

I can reproduced this. What's happened is that on save it automatically adds the file extension to the name of the original file opened - this does not get stripped on the Save As dialog so Windows is saving an Affinity file as an SVG file. 

If you rename your 'corrupt' file from .svg to .afdesign it will open correctly. I shall get this reported. If you want to save to SVG you will need to use File > Export.

Share this post


Link to post
Share on other sites

 

Hi,
 
I found the following problems when exporting SVGs:
 
 
  • 1. Opacity values are changed. E.g. 0.3 becomes 0.298039, 0.65 becomes 0.647059, etc.
  • 2. In paths, precisely positioned nodes are not exported with much precision. E.g. 14 becomes 14.001, 13 becomes 12.999, 0 becomes -0.001, etc.
  • 3. Some rectangles are exported as paths instead of rects
  • 4. AD doesn't memorize settings and the chosen preset between exports. I believe these should be memorized between exports and even saved with the document
  • 5. AD crashed when I created a preset name with a hyphen in it. Can't reproduce it again.
  • 6. Sometimes objects are exported with the wrong size. I believe this happens if you change the DPI setting before choosing an SVG preset, but I didn't test it enough to be sure.
 
I'm not sure if these problems are Windows-specific or not, so please feel free to move this topic elsewhere if it is the case.

 

1. This is because we always export SVG to six significant figures. I've created an improvement to allow a user how many significant figures you're exporting too.

2. Again this is partly covered by what I said above. However even though Affinity might display the figure as just 14, it might not actually be set to that in the background. If you type the values in by hand they should be set exactly to what you type in. Again the significant figure improvement mentioned above should solve this issue.

3. Could you attach a file that exhibits this issue.

4. They're remembered for each session, however after a relaunch you will then have to select your preset. You can create your own presets to save the settings you have chosen.

5. If you cannot reproduce the issue it is unlikely we can do much. Was the crash report sent off once you had restarted the application? If you have that reference number that was displayed on relaunch I can pass it onto a developer to see what might have been the issue.

6. Are you able to provide a step by step recipe for this along with any supporting files?

Share this post


Link to post
Share on other sites

Thanks for the answers. Regarding the first issue, I believe the reason may be beyond that; I think it should generate 0.649999 instead of 0.647059. But it's good to know you are addressing the precision issue (item2) anyway. As for the other issues, I'll try to reproduce them as possible and attach the offending files as soon as possible.

Share this post


Link to post
Share on other sites

Was the crash report sent off once you had restarted the application? If you have that reference number that was displayed on relaunch I can pass it onto a developer to see what might have been the issue.

 

Yes, I've sent the crash report but I'm afraid I don't have any numbers, sorry. This happened about 4 or 5 days ago. I'll try to remember to keep the ref numbers next time.

Share this post


Link to post
Share on other sites

Hi again,

 

I'm including an example AD file with a couple of exported SVGs and the settings I've used. Rectangles upper detail and bottom detail were exported as paths (item 3).

 

Item 6: after some testing, now I understand that SVG files are dependent of the DPI settings. This was a bit confusing for me because DPI should only make sense in printed media. So I didn't think it would make a difference, but it does (see attached SVGs). Now I know that I have to remember using 96 dpi (Windows' resolution) at all times for digital files.

 

Steps to reproduce item 4: open Export Settings, set 96 dpi, and change to any of my presets. The settings go back to 72 dpi even if my preset says "use document resolution" or is set to 96 DPI (see the screenshots).

 

As a side note, the message "nothing will be rasterised" (in British even if my settings are US-English) completes the confusion since it may look like "don't bother with DPI, this is SVG". So now you get the whole picture.

svg_problems.zip

Share this post


Link to post
Share on other sites

Thanks for that Rubs!

 

3. That is because they are actually no longer 'Rectangles' within Affinity. You can see in the Layers Panel that they're listed as (Curves) where as the others are (Rectangle). They have been converted to curves (Ctrl+Enter is the shortcut to do this, otherwise it can be found on the Layers menu) - so even though it still looks like a rectangle it actually a curve with 4 points. 
4. There appears to be an issue when you save Vector based presets where the value applied to 'Use DPI' is not getting saved. I've now passed this on to the developers.
6. I cannot say for sure but I believe some software exports their SVGs out with different values. For example I think Inkscape when making a A4/Letter document actually uses 90dpi. Unfortunately I don't know the SVG format well enough to give an educated answer to this.

Share this post


Link to post
Share on other sites

Okay...

 

3. Please look closely. Yes, I've also included two rectangular-shaped curves named panel right and panel left for the sake of comparison. But the two objects named upper detail and bottom detail are rectangles. Yet they were exported as paths in the SVGs.

4. Yes, that's it.

6. Okay. Anyway I think this is something to look at more closely.

 

Thanks again.

Share this post


Link to post
Share on other sites

Okay...

 

3. Please look closely. Yes, I've also included two rectangular-shaped curves named panel right and panel left for the sake of comparison. But the two objects named upper detail and bottom detail are rectangles. Yet they were exported as paths in the SVGs.

4. Yes, that's it.

6. Okay. Anyway I think this is something to look at more closely.

 

Thanks again. lo

3. Sorry about that - when I exported them myself they were fine. What is happening is that you have 'Flatten Transform' enabled on your export which will remove the SVG 'transform' attribute applied to objects (makes for smaller more compact SVGs as i'm sure you're well aware). The two objects you have referenced are actually rotated 90degress within the app (see the Transform Panel). This is why they're converted to paths when you're exporting.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×