"Stroke to Path" conversion doesn't transfer color for <path> objects in some cases
Steps to reproduce:
- open Inkscape
- open attached file: Example.svg
- Edit > Select All
- Path > Stroke to Path
What happened?
Before pressing "Path > Stroke to Path"
After pressing "Path > Stroke to Path"
The fill
attribute for all <path>
objects in my example are not inheriting the stroke color, which is what I would expect "Stroke to Path" to do.
In the SVG file itself, the generated style
attribute appears as:
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill-opacity:1;fill-rule:nonzero;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter-blend-mode:normal;filter-gaussianBlur-deviation:0;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;stroke:none;opacity:1"
Nowhere in the style is the fill
property mentioned.
Interestingly, the <rect>
and <circle>
objects do not have the same issue and correctly inherit the color. The generated style
attribute looks like this:
style="color:#000000;font-style:normal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:medium;line-height:normal;font-family:sans-serif;font-variant-ligatures:normal;font-variant-position:normal;font-variant-caps:normal;font-variant-numeric:normal;font-variant-alternates:normal;font-variant-east-asian:normal;font-feature-settings:normal;font-variation-settings:normal;text-indent:0;text-align:start;text-decoration:none;text-decoration-line:none;text-decoration-style:solid;text-decoration-color:#000000;letter-spacing:normal;word-spacing:normal;text-transform:none;writing-mode:lr-tb;direction:ltr;text-orientation:mixed;dominant-baseline:auto;baseline-shift:baseline;text-anchor:start;white-space:normal;shape-padding:0;shape-margin:0;inline-size:0;clip-rule:nonzero;display:inline;overflow:visible;visibility:visible;isolation:auto;mix-blend-mode:normal;color-interpolation:sRGB;color-interpolation-filters:linearRGB;solid-color:#000000;solid-opacity:1;vector-effect:none;fill:#000000;fill-opacity:1;fill-rule:nonzero;stroke:none;stroke-width:1;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-dasharray:none;stroke-dashoffset:0;stroke-opacity:1;filter-blend-mode:normal;filter-gaussianBlur-deviation:0;color-rendering:auto;image-rendering:auto;shape-rendering:auto;text-rendering:auto;enable-background:accumulate;stop-color:#000000;stop-opacity:1;opacity:1"
As one can see fill:#000000
is correctly included.
What should have happened?
The "Stroke to Path" output for the <path>
objects ideally should set the fill
to the stroke
value from the original <path>
. Visually nothing should change by performing "Stroke To Path".
Other notes
I've noticed that this issue doesn't happen if I create objects directly within Inkscape. But since I mostly deal with SVGs created outside of Inkscape, this is still an issue for me. I thought a possible workaround would be to first load the SVG into Inkscape, save it as an Inkscape SVG, then reopen it and run "Stroke to Path". But the same issue still happens.
I've also tried the exact same steps in Inkscape 0.92.2 5c3e80d, 2017-08-06
, and cannot replicate the issue, so there must be a regression between these versions. (I'd try something newer than 2017 if I could, but I've had issues installing Inkscape on macOS, unless I installed using Homebrew. But the Homebrew version appears to still be on 0.92.2)
Inkscape Version and Operating System:
- Inkscape Version: 1.0beta1 (32d4812, 2019-09-19)
- Operating System: macOS
- Operating System version: 10.14.6