Export to PDF inverts clipping

Bug #1527642 reported by sam tygier
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Inkscape
New
Undecided
Unassigned

Bug Description

I have an inkscape file that uses a shape to clip a bitmap. When I export it to PDF the clipping is inverted. I have attached a minimal file with just the bitmap clipped by the shape.

Inkscape 0.91 on fedora. viewing the PDF with atril, evince and firefox so I believe it is an inkscape export bug, rather than a poppler render bug.

To reproduce, open the attached svgz file, note shape. Save as a PDF. Note that the shape is now a cut out from the bitmap.

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

> that uses a shape to clip a bitmap

This description does not really match what is inside the minimal test case - the clip is actually a nested group structure with yet another clip applied to a group inside the top-level group in the clipPath definition:

 <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath66">
      <path
         d="m 64.71,45.36 398.664,0 0,373.68 -398.664,0 0,-373.68 z"
         id="path68"
         inkscape:connector-curvature="0" />
    </clipPath>

    <clipPath
       clipPathUnits="userSpaceOnUse"
       id="clipPath4927">
      <g
         id="g4929"
         transform="matrix(1.25,0,0,-1.25,72.169206,667.14622)">
        <g
           id="g4931"
           clip-path="url(#clipPath66)">
          <path
             d="m 129.77548,230.95403 5.35348,42.37718 0,0 3.0712,-0.39658 3.06895,-0.4135 3.06664,-0.43042 3.06421,-0.4473 3.0617,-0.46419 3.0591,-0.48106 3.0564,-0.49791 3.05361,-0.51475 3.05073,-0.53157 3.04775,-0.54838 3.04468,-0.56516 3.04152,-0.58194 3.03826,-0.59869 3.03492,-0.61543 3.03149,-0.63215 3.02795,-0.64885 3.02433,-0.66552 3.02061,-0.68219 3.01681,-0.69882 0,0 -9.75378,-41.58545 0,0 -2.78746,0.6457 -2.79098,0.63032 -2.79441,0.61493 -2.79775,0.59952 -2.80102,0.58409 -2.8042,0.56864 -2.80729,0.55318 -2.81029,0.5377 -2.81321,0.5222 -2.81605,0.50668 -2.8188,0.49116 -2.82146,0.47562 -2.82405,0.46006 -2.82653,0.44448 -2.82894,0.4289 -2.83127,0.4133 -2.83349,0.39769 -2.83565,0.38207 -2.83771,0.36644"
             style="fill:none;stroke:#0000ff;stroke-width:1;stroke-linecap:square;stroke-linejoin:round;stroke-miterlimit:10;stroke-dasharray:none;stroke-opacity:1"
             id="path4933"
             inkscape:connector-curvature="0" />
        </g>
      </g>
    </clipPath>

The SVG file as is does not render any visible content in other SVG viewers because the outer clipPath is invalid - there are no groups allowed in clipPath definitions. This is already tracked in bug #1019159 and bug #1441152 (Inkscape may produce invalid clipPath definitions).

During PDF export, the two nested clipPath applications seem to get pulled out of the nested group structure and effectively applied as combined to one, which - based on the geometry of the two clipPaths - does produce the effect of 'cutting' a hole out of the bitmap (see attached SVG file). I'm not sure whether this should be considered a bug in Inkscape's PDF export, since the clipPath as-is is not valid SVG to begin with.

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

Here's the test case with the clip redone (cleaned-up, based on what appears to be the user's intent).
This version exports to PDF as expected.

Revision history for this message
sam tygier (samtygier) wrote :

Ok that makes sense. 1527642-clip_test-clip-fixed.svg renders and exports as I intent it to.

My shape comes from a pdf made in matplotlib, imported into inkscape. So I guess somewhere in the pdf importer it is creating the badly nested structure. would it be useful for me to make a minimal matplotlib pdf that will trigger this?

Even so it would be good if the rendering within inkscape of the bad nesting was consistent with the export. Or if inkscape could repair it somehow.

Revision history for this message
Tavmjong Bah (tavmjong-free) wrote :

sam tygier,

Yes, it would be very helpful to have a minimal pdf which when imported into Inkscape creates the nested clip paths.

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.