Author Topic: Error with large file  (Read 841 times)

November 04, 2018, 03:08:55 PM
Read 841 times

dubeux

  • Sr. Newbie

  • Offline
  • **

  • 3
Hello,
I've been using inkscape for some years, mostly for rather basic stuff. It's my first post here.
I'm working on a map, which I started by importing a pdf from OpenStreetMap. The original pdf was a 6 MB file.
My svg is now a 27 MB file. Anything I try to do takes some time, which I guess is to be expected. My problem: when I try to export to pdf, it crashes.
Could it be a strict performance issue? Anything I could try?
I have already Cleaned up the file.
My system: ubuntu 18.04, inkscape 0.92.3, core i5, 8 GB RAM, SSD.
I have searched for info on performance settings, but I'm not sure what would be a sensible rendering cache size.
Not sure it would be of any help, but here is the file: https://dubeux.com/temp/map-5.svg
Thanks for any help.
  • 0.92.3
  • ubuntustudio 18.04

November 04, 2018, 03:35:07 PM
Reply #1

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

Here's a tutorial about performance issues, which will help you make some decisions about how you might be able to handle it.  https://forum.inkscapecommunity.com/index.php?action=articles;sa=view;article=35

I'll try to open your file, and if I can, I can give you some concrete info about it.  I'll post back shortly.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 04, 2018, 05:02:09 PM
Reply #2

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Ok, I managed to open it, and even to zoom in a bit, to look at some of the minute detail.  The first thing I wanted to try is File menu > Clean Up Document.  But that only removed 3 defs, which is next to nothing, and won't help significantly.

My next thought was to wonder if you need all that detail.  For example, see my screenshot, where I zoomed in a little.  Over on the right side I've selected and colored a tiny red object (a building, I guess) and a blue one.  If you don't need that much detail, then removing all those apparent buildings will make a Big difference.  Or there are a lot of other details which potentially could be removed, if they might not be needed.

Or if you don't want to remove any detail, then I wonder if it all needs to be vector content?  If it doesn't have to be vector, you could save some file size by changing some or even most of it to raster, using Edit menu > Make a bitmap copy.

The next thing I thought of is to move certain contents into several new layers.  Then you can hide various layers, which will allow you to continue working in another layer.

Edit menu > Find would be helpful to select all of a particular type of contents, for whatever purpose you choose.

There are several objects which I've only found at random, which have more nodes than they really need.  And while reducing the number of nodes would save some file space, I can't think of any way to find them all.

Omgoodness, I can spend hours looking at maps of places I've never heard of!  I should have learned to avoid questions about map files by now, haha!  I find maps with this kind of details irresistible, despite the fact I have no use for them.

Well anyway, getting back to your question about saving the file as PDF.  I don't know if this would work or not.  I've never actually tried it.  But I wonder if you hid all the layers before saving the file, if that might prevent it from crashing?  It probably won't help.  But I'd probably try it anyway.  Maybe if Inkscape wasn't spending so much RAM just displaying the image, it would be able to make the save?  I really have no idea if that's a technically sound thought.  But it can't hurt to try.

I wish I had some better solutions for you.  I suspect none of those will work for you, at least not in a very effective way.  My last thought is to make the map overall smaller by dimension (rather than by removing various types of objects).  But that has the same problem as reducing the number of nodes -- just tedious making the selections.  Maybe someone else will have a better idea?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 05, 2018, 08:39:01 AM
Reply #3

dubeux

  • Sr. Newbie

  • Offline
  • **

  • 3
Hey brynn, thank you very much for your usual kindness - I had already read your performance tips, as well as many posts of you helping people, here.
I had already applied the Clean Up (following your advices in other posts), and created a layer for working on some elements, when I don't need to see the map.
Working on it is not a big deal, the problem is - I need to print it. Exporting to PDF ignores hidden layers, so I need to leave them visible. Also tried command line, had the same error.
I can't work on it right now, but will see if I'm able to rasterize details - may be a solution.
Other than that, I'm still not sure about the rendering cache size. The default value was rather low, I've changed to 3000, but apparently, didn't make any difference. Do you think it's worth trying other values?

( and btw, since you love maps and may be wondering, it's Sao Paulo :-) )
  • 0.92.3
  • ubuntustudio 18.04

November 05, 2018, 01:31:53 PM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Oh wow, Sao Paulo is in Brazil, right?  I thought it looked like a Spanish speaking area.  But I guess Portuguese is similar to Spanish.

Well, your questions are outside my understanding.  I can help with file contents, but I don't really understand what the rendering cache size is, or does.  So hopefully someone else will jump in. 

Actually, now that I think of it, I think those settings may all relate to the use of filters.  And your file doesn't look like it uses many, if any filters.  While I still don't understand what that setting does, I think it might not apply to your file.

If someone else could save it as PDF for you, would that help?  Or do you need do this to some number of large files?  I'd be glad to give it a try (I think I have 16 gb of ram).

I didn't realize saving as PDF ignored hidden layers.  As I said, it was an uninformed idea.

Was there an error message?  Or did it just say the unhelpful - internal error, will close now, type of message?

OH! I just had a brainstorm!  There is such a thing as optimizing an SVG file, which can potentially reduce the file size dramatically.  Where did I see that? ....  Oh right.  File menu > Save As > Optimized SVG.  Then a dialog comes up with 3 tabs, with all kinds of options which can remove data from the XML, which is how the file size gets reduced.

It's things like reducing the number of decimal places, so if you don't need really, really precise coordinates, that can take loads of data out of the file.  Well, there are several options, many of which I don't understand.  But others here know what they are.  There's another message somewhere in this forum about it.  Let's see if I can find that....  Here it is:  https://forum.inkscapecommunity.com/index.php?topic=1193.0

So if you can reduce the SVG size, maybe you can finally save as PDF?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

November 06, 2018, 08:48:15 AM
Reply #5

dubeux

  • Sr. Newbie

  • Offline
  • **

  • 3
Ok, so I tried the Optimized SVG - it did reduce the file a lot, without noticeable visual difference. Also tried selecting similar elements (with Edit>Selec Same>Fill and stroke) and combining them - this could be a solution, but the combined object, in such a detailed file, changes the order of objects. I tried arranging them, but at some point realised it wasn't viable.
With the same tool, I tried to convert similar objects to bitmap. None worked - when trying to save as PDF, I always got the same message ("Inkscape encountered an internal error and will close now"). And changing the size of rendering cache didn't seem to make any difference (it tops in 4096).
I ended up with quite an ugly solution - exported to PNG. Of course I'd rather a vector file to print, but it will work.
But I did learn a few things, and that's great. Thank you very much, brynn, for your always helpful efforts.
.
As for Sao Paulo - yep, Brazil's largest city. And yes, portuguese is a close language to spanish - the closest, among latin languages (afaik).
Downtown is on the upper right. Avenida Paulista, a main avenue, is on numbers 5 and 6.
 :th:
  • 0.92.3
  • ubuntustudio 18.04

November 07, 2018, 08:49:36 AM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Also tried selecting similar elements (with Edit>Selec Same>Fill and stroke) and combining them - this could be a solution, but the combined object, in such a detailed file, changes the order of objects. I tried arranging them, but at some point realised it wasn't viable.

Yes, I thought of that.  It could work....well, it could help, I should say.  But would take a lot of work to do it.

Oh, I'm surprised that reducing the file size didn't allow you to save as PDF!  That must mean that file size was not the problem.  Either that, or it just wasn't reduced enough.  Hhmm....  In the Save As PDF dialog, did you try both PDF versions?  Also use convert text to path, instead of embedding fonts.

Hhmm, when I try it, I don't get any error message, but Inkscape freezes fatally.  Yes, I tried both PDF versions and text to path.

Looking closer at the file, I found some Flowed Text, which could be problematic.  It looks like all the text you added was flowed text.  But after converting it to paths, I still couldn't save the file.

Ok, this is my last guess about what might be wrong with the file, which could be preventing saving as PDF.  I opened the XML Editor, which took forever to open.  I've never noticed that it takes longer, in a large file, before.  But there is something odd about the XML which leads me to think it might be partially corrupt.  Someone else will have to chime in on this part, because I'm certainly not fluent in XML.

I'm concerned about these large empty spaces in the code, which appear to be enclosed by double-quotes.  Please see the attached screenshot.

Ah-HA!!!  When the XML Editor is open, my file manager identifies the file as "invalid SVG file", which means it's corrupt.  This must be your problem!  Theoretically, it should be possible to open the XML file in a text editor, and remove the corrupt portions.

Hhm, they seem to be related to the number/pointers you added.  I'm looking at #8, at the moment.  I don't seen any unexpected characters in the text editor, where those quotation marks are.  There are just a few blank lines of code there.  The "8" has a huge amount of code for the style attribute, which I haven't seen before.  Even though I've converted the text to path, the value for the style attribute still has a lot of references to font.  Although to be honest, I don't know if that's part of what makes it corrupt.

Well, hopefully someone who knows more about XML than me, can figure out what's wrong.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann