Inkscape.org
Beginners' Questions Maintain stroke width when zooming objects → non-proportionally ←
  1. #1
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    – I'm on Windows 10, German edition, and on Inkscape Inkscape 1.2 (dc2aedaf03, 2022-05-15).

    – I've got a document containing a path atop a rectangle, both having an equal stroke width of 5 px.

    – I've unset the preferences option to scale stroke width.

    – I've unset the icon in the top right corner with the tooltip, “When scaling objects, scale the stroke width by the same proportion”.

    – I select both objects and transform the width, not the height.

    See 1st screenshot, highlighting in purple just what I did.

     

    I was hoping that the stroke width should remain at 5 px after the transformation, just as I specified. But instead, the transformation does affect the stroke width; it is now far thicker than 5 px at the top and bottom and far thinner than 5 px at the sides. This pertains to the pure path (top) as well as to the rectangle (bottom).

     

    So how do I stop this annoying effect? Extensive googling hasn't turned up an answer, besides turning off the two options that I did turn off.

    Transform2
    Transform1
  2. #2
    Polygon Polygon @Polygon🌶
    *

    Seems you put it as a group;  ungroup and transform again please.

    ("ungrounded"? Damn autocorrection) 🙄

  3. #3
    Paddy_CAD Paddy_CAD @Paddy_CAD

    You can also do this without ungrouping. [double-click] or [ctrl+return] to enter the group. Select all [ctrl+a]. Now you can stretch your shapes, preserving the stroke thickness. [ctrl+backspace] to leave the group.

  4. #4
    Tyler Durden Tyler Durden @TylerDurden

    A simple ungroup and regroup usually works for me.

  5. #5
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    In the original experiment above, I selected the two objects together, I didn't group them. But, fair enough:


    I'm repeating the experiment using just 1 object, a path with 3 nodes. Shrinking the path horizontally but not vertically still repeats the effect that the stroke width is scaled, and scaled unevenly.

    Uneven Zoom 2
    Uneven Zoom
  6. #6
    Eric Woodcock Eric Woodcock @EricWoodcock

    @Paddy_CAD

    It seems that your second constellation shows the effect I was talking about: The stroke thickness in the horizontal portions of the stroke is bigger than the thickness in the vertical portions. The third constellation is different: Now the strokes have uniform thickness. What did you do to get from #2 to #3?

  7. #7
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    ..

  8. #8
    Polygon Polygon @Polygon🌶

    Can you show us a screenshot of the 2 parts you selected in the first screenshot in the Object->Layers and Objects panel?

  9. #9
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    @Polygon

    Here you go. I'm attaching:

    • The .svg
    • Picture: Selecting (with the mouse, not grouping) and shrinking both objects
    • Picture: Selecting and shrinking just the path (upper object)
    • Picture: Selecting and shrinking just the rectangle (lower object)

    In all cases, the stroke at the top & bottom becomes thicker, the strokes at the sides become thinner.

    Uneven Stroke 3A
    Uneven Stroke 4B
    Uneven Stroke 4A
    Uneven Stroke
  10. #10
    Paddy_CAD Paddy_CAD @Paddy_CAD

    In my comment #3 above, the centre shapes are a group of two objects. Scaling svg groups stretches stokes and fills alike. The shapes on the right are not grouped so stroke widths were preserved. This is the expected behaviour.

    I opened your svg attachment and used the Select tool [s] to stretch the shapes. Stroke thickness was preserved. I see thinning and thickening of strokes while dragging the selection handle, but it reverts to the original stroke width when I release the mouse button.

    The XML Editor shows transforms applied to your shapes so I went to Inkscape Preferences then [Behaviour > Transforms > Scale stroke width]. This changed from no thickening to uniform thickening, but not the uneven thickening in your screenshots.

    I'm at a loss. I can't explain your experience. What happens if you use the node tool [n] and [ctrl+drag] to scale the shapes?

  11. #11
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    What can I do to show you more about my setup?

    Here's the preferences.xml file in %APPDATA%/Roaming/Inkscape (attached).

  12. #12
    Paddy_CAD Paddy_CAD @Paddy_CAD

    Perhaps you can download this svg image. Scale the shapes and tell us what happens.

  13. #13
    Polygon Polygon @Polygon🌶
    *

    Pretty sure you scaled the Layer and not the object then:

    This Transform Matrix will stay alive and is valid for any applied objects unless you´ll correct it or delete that layer and generate a new one:

     

  14. #14
    Paddy_CAD Paddy_CAD @Paddy_CAD

    Well spotted Polygon!

  15. #15
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    @Polygon

    So, here's an all new document (attached, uneven-stroke0.svg).

    • The first pic (attached, 5a) shows all of the XML of the document and the attributes of the node with id layer1: Layer 1 does not have any matrix transformation.
    • The second pic (attached, 5b) shows the attributes for the node with id rect1090: The rectangle does not have anx matrix transformation
    • As before, I now shrink the rectangle horizontally but not vertically – by grabbing the middle right handle “⇔” and moving it to the left.
    • Now, I get the situation in the third pic (attached, 5c): Distorted stroke. Now the rectangle does have a transformation, but that's kind of the point of the horizontal but not vertical shrinking.
    • The fourth pic (attached, 5d) shows that the layer, however, still does not have any transformation.
    Uneven Stroke0
    Uneven Stroke 5D
    Uneven Stroke 5C
    Uneven Stroke 5B
    Uneven Stroke 5A
  16. #16
    Polygon Polygon @Polygon🌶

    I´m not able to recreate this following your steps. Are you really sure you´re not scaling the Layer instead of the rectangle by accident? Once you scaled the Layer all objects will have a transform matrix unless you delete it in XML editor.

  17. #17
    Eric Woodcock Eric Woodcock @EricWoodcock
    *

    I don't know what to say.

    I'm now including a film (window capture) that shows exactly what I'm doing, in file 2023-10-28_18-30-50.mp4. I've saved the document immediately before that (uneven-stroke0.svg) and immediately afterwards (uneven-stroke1.svg)

    I've opened both files in Notepad++ and had it compare them to each other, and I can't see any transformation to the group <g … id="layer1"> that might have been added by my handling. Differences would be highlighted in the screenshot uneven_stroke6.png. In the "before" document uneven-stroke0.svg, the group does not have a transformation, as also shown in the screenshot.

    The result is in the screenshot uneven-stroke6.png, attached, showing the stroke distortion. Even when I close Inkscape completely and re-open it with uneven-stroke1.svg, it shows the distortion (shown in screenshot uneven-stroke6.png).

    Note that I'm transforming the rectangle, not the triangle, which both are children of the layer. If I was transforming the layer, wouldn't both the triangle and the rectangle be affected?

    Uneven Stroke6
    Uneven Stroke1
    Uneven Stroke0
  18. #18
    Polygon Polygon @Polygon🌶

    I still don´t get how you introduce the transform matrix just by scaling the object horizontally. This is how your file works here. Notice that I´m deleting the tag from the XML and it won´t get introduced again:

    Does Inkscape always works that way or just started after an update? if the latter please consider: Inkscape Preference->System hit "Reset Preferences" and restart Inkscape. Fingers crossed.

     

  19. #19
    Paddy_CAD Paddy_CAD @Paddy_CAD
    🆒

    Open Inkscape Preferences then [Behaviour > Transforms > Store Transformation > Optimised]. In your case [Store Transformation > Preserved] applies a transform when you scale an object in your drawing, instead of recalculating the node positions.

    I should have remembered this sooner, but I think we finally got there.

  20. #20
    Polygon Polygon @Polygon🌶

    Hurray. Never touched this in Preferences so I totally forgot about this.

  21. #21
    Eric Woodcock Eric Woodcock @EricWoodcock
    👍*

    @Paddy_CAD

    Can confirm that setting Edit > Preferences > Behavior > Transforms > Store Transformation  to  “Optimized” solved my problem.

    Thanks a lot!

Inkscape Inkscape.org Inkscape Forum Beginners' Questions Maintain stroke width when zooming objects → non-proportionally ←