Not saving when using Optimized SVG

Bug #902843 reported by javsmo
12
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

I'm trying to optimize a file that has 77MB by saving "Optimized SVG", but after some time saving, there's no output file on folder.

I tried first on a MacOS X machine and thought that the problem were specific from Mac version (0.48.1 r9760 using X11). Then I installed the latest 0.48.2 on a Windows XP machine and the same problem occurred.

Back to Mac, I opened a terminal and used the lsof command to see which svg files were open. And only the file I was editing was open, as you can see bellow.

$ lsof | grep svg
Finder 346 javsmo 49r REG 14,1 80719360 13953094 /Users/javsmo/Dropbox/[...]FASE 5.svg

(the "[...]" is just to shorten the path)

After this, I started the Save As Optimized SVG and made another lsof command

$ lsof | grep svg
Finder 346 javsmo 49r REG 14,1 80719360 13953094 /Users/javsmo/Dropbox/[...]FASE 5.svg
inkscape- 10046 javsmo 10u REG 14,1 15839232 13996773 /private/var/folders/n8/1h0_dfy5429cqqfsl7ljb_bh0000gn/T/ink_ext_XXXXXX.svgMUQM6V
inkscape- 10046 javsmo 11w REG 14,1 15839232 13996773 /private/var/folders/n8/1h0_dfy5429cqqfsl7ljb_bh0000gn/T/ink_ext_XXXXXX.svgMUQM6V

It seems that the Inkscape is working on an optimized file, but it is not copying the result file to the correct folder. Also the optimized file on temp directory has the same size of the original file.

On Windows, I also tried to save on "Downloads" folder to be certain that there were no problem caused by Dropbox.

su_v (suv-lp)
tags: added: saving
removed: optimized-svg save-as
Revision history for this message
su_v (suv-lp) wrote :

Please attach the SVG file that fails to be saved as 'Optimized SVG' - this is possibly an upstream bug in scour (the python script on which this output extension for 'Optimized SVG' is based on).

> It seems that the Inkscape is working on an optimized file,
> but it is not copying the result file to the correct folder.

It is part of Inkscape's extension system that extension scripts work on a copy of the original file in $TMPDIR, and if the script processes the file successfully, the content is piped back to inkscape / the final output file. Usually, if the script fails (for whatever reason), an error message is sent back to Inkscape instead, and no output file created.

Revision history for this message
su_v (suv-lp) wrote :

> I'm trying to optimize a file that has 77MB by saving "Optimized SVG",
> but after some time saving, there's no output file on folder.

Possibly processing such a huge vector file exceeds what can be handled within a reasonable time frame in an interpreted language like python (Python 2.6 on Windows, Python 2.5.1 on Mac OS X 10.5.8 Leopartd and Python 2.6 on Mac OS X 10.6 Snow Leopard)?

Changed in inkscape:
status: New → Incomplete
tags: added: extensions-plugins
Revision history for this message
javsmo (javsmo) wrote :

Before posting here a 77MB file, could I try using scour directly on command line to see what kind of error it is having?

Do you know the parameters Inkscape uses to call scour?

(I found it on Inkscape.app folder /Applications/Inkscape.app/Contents/Resources/extensions)

The python version installed on my Mac is 2.7.1 and I'm using MacOS X Lion 10.7.2.

Revision history for this message
su_v (suv-lp) wrote :

> could I try using scour directly on command line to see what kind of error it is having?

You can download scour from <http://www.codedread.com/scour/> - I'm not sure though which version of Scour Inkscape 0.48.1 and 0.48.2 have bundled. Make sure to use the same options as set in the export dialog in Inkscape's GUI.

> The python version installed on my Mac is 2.7.1 and I'm using MacOS X Lion 10.7.2.

Python-based extensions do no work with the official Inkscape package on Mac OS X Lion (-> bug #819209).

Revision history for this message
su_v (suv-lp) wrote :

(Bug #819209 does not apply if you installed Inkscape with MacPorts, it is only a packaging issue)

Revision history for this message
javsmo (javsmo) wrote :

The scour version shipped with Inkscape 0.48.1 is VER = 0.25. The latest version available is 0.26.

I'll try both with same options set in the export dialog.

Revision history for this message
su_v (suv-lp) wrote :

> Do you know the parameters Inkscape uses to call scour?

Did you use the default options? Those are defined in
'/Applications/Inkscape.app/Contents/Resources/extensions/scour-inkscape.py'
(in 'def __init__(self):')

The last used options are saved in the preferences file
'~/.config/inkscape/preferences.xml'
(search for 'org.inkscape.output.scour.')

The settings from 'preferences.xml' override the default values defined in 'scour.inkscape.py'.

Revision history for this message
javsmo (javsmo) wrote :

It seems to be that problem with Lion (Bug #819209 you mentioned)

Running scour.py and scour.inkscape.py finished without any error and returned an "optimized" version of my file:

==============================================

$ python /Applications/Inkscape.app/Contents/Resources/extensions/scour.py -i /Users/javsmo/Dropbox/workspace/[...]/FASE\ 5.svg -o /Users/javsmo/Desktop/FASE5.svg --set-precision=4 --indent=none --enable-id-stripping --keep-editor-data --strip-xml-prolog

scour 0.25r171
Copyright Jeff Schiller, 2010
 File: /Users/javsmo/Dropbox/workspace/[...]/FASE 5.svg
 Time taken: 89.28s
 Number of elements removed: 359
 Number of attributes removed: 2465
 Number of unreferenced id attributes removed: 2271
 Number of style properties fixed: 3515
 Number of raster images embedded inline: 0
 Number of path segments reduced/removed: 3197
 Number of bytes saved in path data: 73676
 Number of bytes saved in colors: 4479
 Number of points removed from polygons: 0
 Original file size: 80719360 bytes; new file size: 80250056 bytes (99.41%)

==============================================

 python scour.inkscape.py /Users/javsmo/Dropbox/[...]/FASE\ 5.svg > /Users/javsmo/Desktop/FASE5-ink.svg

==============================================

Thanks for your help @suv!

Revision history for this message
su_v (suv-lp) wrote :

> I tried first on a MacOS X machine (…) (0.48.1 r9760 using X11)
> Then I installed the latest 0.48.2 on a Windows XP machine and
> the same problem occurred.

and

> It seems to be that problem with Lion (Bug #819209 you mentioned)

This doesn't really make sense to me yet: you originally reported that both on Mac OS X and on Windows, Inkscape failed to save the large file as 'Optimized SVG'.
- If you ran that initial test on OS X Lion ( as opposed to Snow Leopard), I would have expected that Inkscape returned the infamous error message "The fantastic lxml wrapper for libxml2 is required by inkex.py …" and aborted the save operation.
(You might have installed lxml for /usr/bin/python (Python 2.7) on your system, or used the egg-bot installer for the extensions (which forces Inkscape to use Python 2.5) ?)
- If it works with the scour script on OS X Lion on the command line, I wonder why it then failed on Windows XP…

Revision history for this message
javsmo (javsmo) wrote :

Yes, you are right. Both Windows and Mac failed to save this file as Optimized SVG.

No error message appeared to me on both machines. It gives me an "wait" cursor as it is saving and after some time (a minute or maybe more) it returns to my drawing as if it has saved the file, but the target folder has no file saved.

I don't have Python installed on Windows to test on command line. I have to install to test.

On Mac Inkscape.app folder I found lxml and numpy on 2.6 folder

$ pwd
/Applications/Inkscape.app/Contents/Resources/python/site-packages/i386/2.6
$ ls
lxml numpy

I also have an Inkscape installed via Macports (installed it on last week), but I'm not using it because it crashes on some random situations.

$ inkscape -V
Inkscape 0.48.2 r9819 (Dec 9 2011)

Revision history for this message
javsmo (javsmo) wrote :

Does the file still matters for this problem? If you want I can attach a bzip2 compressed file (55MB).

Revision history for this message
su_v (suv-lp) wrote :

> If you want I can attach a bzip2 compressed file (55MB).

If you don't have privacy or copyright concerns, yes: it would allow to test it on other platforms / system with different python versions.

Revision history for this message
javsmo (javsmo) wrote :

I'll let the file uploading this night.

There's no copyright concern (I made it on all aspects). I just would ask to remove the file as soon the bug/problem become solved. Is this possible?

Revision history for this message
su_v (suv-lp) wrote :

> I just would ask to remove the file as soon the bug/problem
> become solved. Is this possible?

Yes, this is possible. It will not get done automatically, but whoever will close the report can also remove the attachment at that time. Maybe add a note to the original bug description (there's an 'Edit' button in the top right corner so that it doesn't get overlooked.

You also have the choice to mark the report as 'Private' once you have attached the file (see link at the top of the sidebar): private reports are only accessible by members of the project's bug team and administrators.

Revision history for this message
javsmo (javsmo) wrote :

It was easier to me to give the public Dropbox link for this file. The file was already there, I just had to move it to public.

Here's the link:

http://db.tt/WtMA8s1U

If posting the link here is not adequate, let me know and I'll upload the file to this bug report.

Revision history for this message
su_v (suv-lp) wrote :

Saving as 'Optimized SVG' works from within the GUI without failure using
Inkscape 0.48.2 with Python 2.6.7 on Mac OS X 10.5.8 (i386)
MBP late 2008, 2GB RAM, Intel C2D 2.4GHz

Inkscape takes close to two minutes (1'45'') to load the file, grabbing all available system resources (RAM) and outputs a warning to the console:
** (inkscape:43587): WARNING **: GC Warning: Repeated allocation of very large block (appr. size 6254592):
 May lead to memory leak and poor performance.

Saving a copy as 'Optimized SVG' takes about 3-4 minutes on my system until the new file is fully written: the closing of the export options dialog does not indicate that the output extension is finished (you can monitor the Python process in the 'Activity Monitor') - if I remember correctly, Inkscape notifies with a message in the status line when the saving is actually done.

> It gives me an "wait" cursor as it is saving and after some time
> (a minute or maybe more) it returns to my drawing as if it
> has saved the file, but the target folder has no file saved.

Possibly you didn't wait long enough, on either system…?

Revision history for this message
su_v (suv-lp) wrote :

@Alvin - would you be willing to test saving a copy as 'Optimized SVG' on Windows XP or 7?

Changed in inkscape:
status: Incomplete → New
Revision history for this message
Alvin Penner (apenner) wrote :

yes, I'll give it a try tomorrow AM.

Revision history for this message
Alvin Penner (apenner) wrote :

- on Windows 7, Inkscape 0.48.2, the file took a few minutes to load and generated the warning message:
** (inkscape.exe:3704): WARNING **: GC Warning: Repeated allocation of very large block (appr. size 6254592):
        May lead to memory leak and poor performance.
- no problems encountered when saving as optimized svg, using original default values. Original svg file size was 80,719,360. Optimized svg file size was 80,219,877.

- no problems encountered on Windows XP, Inkscape rev 10755. No warning messages were seen. In both cases the memory usage was about 2 GB according to Task Manager.

javsmo (javsmo)
visibility: public → private
Revision history for this message
javsmo (javsmo) wrote :

@~suv I really wasn't waiting for the process to finish.

I tried again with Activity Monitor running and saw that the python process continues after the application dialog is dismissed and the program receives control again.

The total duration of this process was about 3 minutes on my MBP mid 2010 with 4GB RAM 2.4GHz C2D (reading file and saving the optimized version).

As I didn't have any success confirmation message and the file wasn't there when the program received control again, I thought it didn't have saved the file.

I think that an alert with a message telling the user to wait the process to finish and some indication after it finishes, would be nice, as there's no clue to user know when the python finished the saving process. I waited the process to finish and didn't see any message on status bar, either.

Revision history for this message
su_v (suv-lp) wrote :

> I think that an alert with a message telling the user to wait the
> process to finish and some indication after it finishes, would be nice

Already filed as
Bug #616129 “Progress Dialog for Save As Optimized SVG”
<https://bugs.launchpad.net/inkscape/+bug/616129>

I should have done more comprehensive searches in the bug tracker earlier on - sorry for the inconvenience that caused. Would you agree to either close this report as 'Invalid' (saving as 'Optimized SVG' does work successfully, even with such large files), or to mark it public again and link as duplicate to bug #616129? I think that it would serve as a good example to emphasize the need for a progress report or indicator when saving to a file format based on a script extension (which do not block the user from working in Inkscape's main window).

Revision history for this message
javsmo (javsmo) wrote :

I think that mark as "duplicate" is more interesting, as other people could have the same problem an think it is a bug, as I thought.

I removed the file from my public Dropbox folder. You can change this ticket to public again.

Thanks!

Revision history for this message
su_v (suv-lp) wrote :

Thank you for the feedback - the bug has been reverted to 'public'.

Linking as duplicate to bug #616129 - please add a comment here and revert the duplicate status if you don't agree and think these are different issues after all.

visibility: private → public
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.