3

When I create a rounded polgon and elongate it, when I try to export it as a pdf, the thickness of the line changes (thicker in the elongated axis). So I tried object to path and stroke to path, but this causes the same problem. However, this does not happen when exporting as a png.

enter image description here

Any ideas on how to convert to paths without the line thickness changing?

Thanks

  • Can you provide a sample SVG, and Inkscape version? I cannot reproduce in Inkscape 0.91, OSX, Preview.app – Juancho Jun 17 '16 at 14:55
5

UPDATE: With the additional details you provided in the comments I believe I better understood your question, so let me provide an update. The answer below is still valid - if you transform the object as a whole, you distort the stroke. If you don't, you don't. Exporting the shape to a PDF or a PNG should not affect the stroke at all (see below).

I initially mistook your image for a rounded rectangle, sorry about that. To better highlight that we're dealing with a rounded polygon, I'm using a polygon with only 3 corners and roundness 0.2 in the following.

Any ideas on how to convert to paths without the line thickness changing?

Yes. Basically, there are two cases you might be interested in:

1. Scale the shape but keep its aspect ratio without changing the stroke width

  • Simply double click the object (as explained below), then use the object handles. For a polygon the handle will look like this:

  • After you drag the handle to change the size of the shape, your object will still have the same stroke width.

2. Distort the shape (do not keep its aspect ratio) without changing the stroke width

I believe this is the case you asked for in your example ("obtain an object elongated along the x-axis). To achieve this effect:

  • Convert the object to a path.

  • Move the individual vertices along the x-axis until you have elongated the object to your liking.

If you need a hint where to place the vertices, you could move a distorted duplicate with uneven stroke and the exact desired width above and use guides to place your vertices, like so:

Now you have an elongated shape for which you can still edit the (uniform) stroke width.

Some Remarks

  • The button "Scale stroke width by the same proportion" will only work for uniform scaling. That means if you scale the object by different amounts in the x and y dimensions, the stroke will be distorted. This is because the affine object transformation is applied at the end (after the shape has been drawn with stroke).

  • If you stretch the object width, and then convert the object to a path, the (uneven) stroke is converted to a path and you won't be able to edit its width anymore.

  • The stroke of the object does definitely not change when you export it. You can find the exported PDF with the four shapes shown above here. All shapes are as they should be. Same for the PNG. If the stroke seemed uniform in your PNG, maybe the export resolution wasn't sufficient? (Just an assumption)

I hope that answers your question.


ORIGINAL ANSWER

First off: I am assuming that by "rounded polygon" you mean a "rounded rectangle". The effect you're observing is perfectly normal, since you're applying a scaling transformation to the entire object, which will distort/scale the object, including its stroke.

The Problem

Generally, you will distort/scale an object if you drag its bounding box or edit its width and height in the object properties field. In this case, Inkscape doesn't care whether it's an object with a stroke, an image, a group of objects, a complex polygon etc. It simply applies an affine transformation to the object.

For example, create a 100x100 pixel rectangle with a 10 pixel border and a 20 pixel corner radius. Then select the object and change its width to 210 pixels. This is what you will get:

The Solution

Any ideas on how to convert to paths without the line thickness changing?

To scale the object without affecting its stroke, you need to enter "Edit" mode. Then you can drag the handle of the specific object (polygon, star, rectangle, circle etc.) or change the object properties (like width and height) in the appropriate fields. To enter "Edit" mode, double click the object. Inkscape will now be aware of the type of object you're editing and offer you specific fields to change the object properties. In case of a rounded rectangle this will be the width and height of the rectangle, as well as the x and y corner radii. For a star this would be the number of corners, the spoke ratio etc.

If, after double-clicking, you enter 210 pixels in the width field or drag the top-left / bottom-right handle accordingly, you get the desired result (an elongated rectangle with a proper stroke). Note that there are additional handles to change the corner radius interactively.

Important: When you convert the object to a path, you lose the ability to edit the specific properties of the original object. From that point on, the object will be a simple polyline/polygon and you can only apply affine transformations. So, as long as you want to change the object properties and expect your stroke to adapt to those changes, do not convert the object to a path.

  • @holmeswatson Happy to be of service ;-) If that answers the original question, do you mind accepting my answer? Thx. – KlaasNotFound Jun 23 '16 at 10:22
  • sorry I had meant to reply to this in full. When I said rounded polygon I did not mean rounded rectangle, I meant that I was using the stars and polygon tool (in polygon mode) which has a roundness attribute. The polygon tool edit mode does not have the ability to change the width/height proportions. I don't understand why the transformation is applied to the stroke even though the Affect stroke box is unchecked and it doesn't appear to have effected until I try to convert it to pdf or paths. – holmeswatson Jun 27 '16 at 15:45
  • @holmeswatson Ok. I have provided a more detailed explanation and a solution of how to get what you want. The "Affect stroke box" only works for uniform scaling, because affine transformations of the object are applied at the end. – KlaasNotFound Jun 27 '16 at 20:19
  • thank you for your answer, it would have been better if you could have been a tad less condescending considering the post clearly said a rounded polygon and the picture clearly shows that. – holmeswatson Jun 28 '16 at 9:05
  • @holmeswatson Sorry, I did not mean to be condescending at all. I was just confused by the example, since your rounded polygon had exactly four corners and looked exactly like a rounded rectangle - which led me down the wrong path initially... my bad. I'll edit my answer to reflect that. – KlaasNotFound Jun 28 '16 at 9:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.