File Size Accumulation Bug

Bug #1376836 reported by Vidar Bentzen
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

The size of the files I am working on seem to grow completely out of proportion with the content of the file. For example, if the sum of each of the elements that have imported into a combined file equals 10 MB, the file may grow into an unmanageable file of 40-50MB after a while.

This seems to happen each time I delete an elements and import a new one - which may be changed version of the one I deleted. After deletion, there is no visible trace of the element, but the file size remains the same, and when I import the new version of the element, it adds to the total size of the file, which grows and grows each time changes are made that way.

In other words, if seems as if the data from the imported elements (files) remains stored in the combined file also after deletion.

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

Please add information about OS/platform and Inkscape version (see Inkscape menu 'Help > About Inkscape').

To allow further investigation, please attach a sample SVG file, and provide more details about the steps "(…) delete an elements and and import a new one (…)": what file formats are you importing, and how? Could you attach such a drawing which you import into an existing Inkscape SVG document, too?

Changed in inkscape:
status: New → Incomplete
tags: removed: accumulate file size
Revision history for this message
Vidar Bentzen (vb-personal) wrote :

Sorry, should have thought about that: Windows 7 with the latest stable version of Inkscape 0.48.5 r10040.

Sample file attached. These element have been picked from an .ai file after opening it in Inkscape. The "Arrows" file is what remained after deleting most of the elements in the "How to images" file.

For example, when I delete all elements except the arrows, the file size remains at 3.31MB

For example, when I delete all elements except the square background, the file size remains at 3.29MB

When creating a new file with the same square background (same size and color, the virgin file is only 1.70KB.

However, the problem seems to be significantly worse when dealing larger .png elements. (Have not used other file types.)

I am using the import function provided in Inkscape's menu (File > Import) and the element is embedded (not linked).

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

(Note: It's unclear what 'The "Arrows" file' mentioned in the earlier comment relates to (it was not provided) - below answer is based on the actual contents of the file "How to images.svg" without access to the original AI file from which the clip art was imported into the Inkscape document.)

Quick answer:
Use 'File > Vacuum Defs' from time to time to remove unreferenced resources (clip-paths, masks, etc.) from the current document.

Background:
The objects imported from the AI file are actually masked bitmap images inside nested clipped groups. The masks themselves are bitmap images too (which are used for the alpha channel of the bitmap images).

If such a clipped (or masked) group is ungrouped or deleted, or a masked (or clipped) bitmap image itself is deleted, the clip-paths and masks are retained in the <defs> section. Clip-paths and masks are only removed from the <defs> section if the clip or mask is released via corresponding menu command (see menu 'Object'). The command 'File > Vacuum Defs' can be used to cleanup such remains in the current document.

The file size of the attached example shrinks from 3.6 MB to 306 KB after having vacuumed the defs and saved again.

Proposing to link as duplicate to
- Bug #443229 “Embedded alpha channels (masks) aren't removed from file when the images are deleted”
  <https://bugs.launchpad.net/inkscape/+bug/443229>

Changed in inkscape:
status: Incomplete → New
tags: added: bitmap masking
Revision history for this message
Vidar Bentzen (vb-personal) wrote :

Thank you! That definitely solved the problem. A file I was about discard and had started to redo, was reduced from almost 30MB to 1.8 MB. In other words, not a bug, but user ignorance.

Is there a reason for retaining clip-paths and masks instead of deleting them automatically by clicking "Delete"?

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

On 2014-10-02 22:17 , Vidar Bentzen wrote:
> Is there a reason for retaining clip-paths and masks instead of
> deleting them automatically by clicking "Delete"?

Haven't seen a comment by a core developer about this yet (same question in comment #9 of bug #443229).

Linking as duplicate to earlier bug #443229 - if you disagree and think this was done in error, please add a comment here (bug #1376836) and revert the duplicate status.

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.