Embedded alpha channels (masks) aren't removed from file when the images are deleted

Bug #443229 reported by Guillermo Espertino (Gez)
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Inkscape
Confirmed
Low
Unassigned

Bug Description

I just found that alpha channel from embedded images isn't removed from the SVG file when the embedded images are deleted.
I created a copy of an existing file with embedded images, deleted those images and saved, and the result was the attached file, 1.2 MB for a file with two short text blocks and cropping marks.
I wondered why the file was so heavy, and fond that the alphas were still embedded.

Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :
Revision history for this message
su_v (suv-lp) wrote :

Did you embed those images with Inkscape or was the file initially imported as PDF? (reminds me of the masked images in the SVG files attached to bug #427540)
Did you try to unmask/unclip the images before or use 'vacuum defs' after deleting them?

Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

Hmm. Good tip. I have to do further investigation about this.
Now you mention it, maybe it was an imported PDF. I can't remember, but I'll try and report my findings.

Thanks for the feedback.

Revision history for this message
Guillermo Espertino (Gez) (gespertino-gmail) wrote :

~suv: The vacuum defs command worked fine. I guess I have to use it more frequently. :-)
The file was indeed an imported PDF from Illustrator, so this report starts to look invalid.
I'd just like to know if this kind of stuff is covered in the documentation. Never read something about it (maybe I simply missed it).

Revision history for this message
Pablo Trabajos (pajarico) wrote :

> Did you try to unmask/unclip the images before or use 'vacuum defs' after deleting them?
But shouldn't deleting the images remove any def relative to the them?

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

I can reproduce it with the example in bug #427540 <http://launchpadlibrarian.net/31617709/%5C192.168.10.12%5Cgordon%5Cwork%5C2007-ft2%5Cpower-distribution%5Celectrodes-and-clamps-channel-and-forehearth%5C090909-troubleshooting-inkscape-and-pdfs%5Cone-saved-after-opening-original-pdf.svg> :

enter the groups with double-click until you can select an illustration (rather: it's a grouped rectangle with a mask containing the image in the defs section) and delete the object (rectangle) that looks like the image itself.

Result: the image is gone (on canvas) but the embedded bitmap stays in the defs mask definition.
expected: original embedded image in the mask gets removed as well.

Mask:
<mask
       maskUnits="userSpaceOnUse"
       x="0"
       y="0"
       width="1"
       height="1"
       id="mask159"><image
         width="1"
         height="1"
         xlink:href="data:image/png;base64, (…snipped…)"
         id="image161" /></mask>

Illustration:
<g
             id="g157"
             transform="matrix(188.872,0,0,117.055,300.167,240.278)"><rect
               x="0"
               y="0"
               width="1"
               height="1"
               transform="matrix(1,0,0,-1,0,1)"
               style="fill:#000000;fill-opacity:1;fill-rule:nonzero"
               mask="url(#mask159)"
               id="rect163" /></g>

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

workaround: select the (masked) rectangle, release the mask and delete both the image (now in place and no longer in the defs section) and the rectangle.

But why would you use this kind of inverse masking to get a B&W raster image embedded?

tags: added: bitmap importing pdf
Revision history for this message
su_v (suv-lp) wrote :

all wrong: Inkscape leaves any clipping and masking defs behind when deleting masked or clipped objects.

attached file has for 4 variations of clip and mask:
text (as path) masks rectangle
rectangle masks text
text (as path) clips rect
rect clips text

remove the visible text objects with 'delete', check the <defs> section: all clip and mask definitions are still present.
(with Inkscape 0.46+devel r22401, OS X)

tags: removed: bitmap importing pdf
Revision history for this message
su_v (suv-lp) wrote :

…looks like an empty file after deleting the four text objects but the <defs> stay behind. Intentional?

tags: added: bitmaps
tags: added: bitmap
removed: bitmaps
su_v (suv-lp)
summary: - Embedded alpha channels aren't removed from file when the images are
- deleted
+ Embedded alpha channels (masks) aren't removed from file when the images
+ are deleted
Changed in inkscape:
importance: Undecided → Low
status: New → Confirmed
su_v (suv-lp)
tags: added: masking
tags: added: clipping
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

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