gotcha

Author Topic: Filling a shape with pattern that follows the contours of the shape.  (Read 1603 times)

September 22, 2018, 09:57:26 AM
Read 1603 times

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
Hi Guys,

Can someone please shed some light or put me in the right direction. I am running version 0.92 on Windows 10 Home Edition.

I have an image of a strip of patterned material that I'd like to apply as a Fill onto a shape (a slightly curved tall rectangle). This I can achieve by using Object-> Pattern -> Object to Pattern tool to create a Pattern that I can apply as a Fill to any shape.

However I would like the Fill to follow (bend) along the contours of the shape that is being filled (both the image and shape to be filled are the same size and there should be no requirement for the image to repeat within the shape) and I am unable to achieve this.

I have tried to use the Pattern Along Path extension and have watched a number of tutorials on the subject and followed them succesfully. I have then apllied this knowledge on a practice canvas with similar objects to what I will eventually  need to use, with mixed results - that give me encouragement that what I'm trying to achieve is possible. I get the vectorized image to bend, however the shape is not filled completely and using the options to stretch or repeat result in really bizzare outcomes. The resulting image has also been flipped on the horizontal axis

My attempts so far has followed this steps....

After importing the image, I use the Trace Bitmap tool to vectorize the image. I make the vectorized image the topmost object in the layer, draw a bounding box around both the shape and vectorized image, and then use the Pattern Along Path from Extensions > Generate from Path.

I cannot figure out how to use the Path Effects -> Pattern Along Path and unsure if both are the same function. To be honest, I'm not entirely sure Pattern Along Path is what I need to achieve what I want.

Any help or guidance would be appreciated.Capture1.PNG
*Capture1.PNG
(29.64 kB . 387x251)
(viewed 392 times)
  • 0.92
  • MS Windows 10 Home (10.0.17134)

September 22, 2018, 01:58:56 PM
Reply #1

Moini

  • IC Mentor

  • Offline
  • ******

  • 1,568
    • VektorRascheln
Maybe perspective/envelope would be working here - your object has four sides.

September 22, 2018, 10:32:22 PM
Reply #2

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Welcome to the forum!

After you vectorize the image, do you end up with 4 objects?  I can't tell from your screenshot if the weave or knit pattern from the fabric is being traced.  If it is, you likely have many, many objects (making a problem for pattern along path).

I'm just thinking that since the fabric pattern is so simple (2 wide stripes, 2 narrow stripes), it should be fairly easy to just draw the 4 stripes.  Then it's a piece of cake to curve them (using the Node tool, or other tools).
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 23, 2018, 03:06:07 AM
Reply #3

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Hi.

Pattern along path is limited to one path only  as far as I know.
After the trace bitmap option you have a group of paths. Therefore selecting it and applying the path effects/bend path effect would be a better tool.
It will show then a core line of your group you can bend to any shape.
By default that line is drawn horizontally, so you may need to rotate the group first by 90°, ungroup it and re-group those objects.
Because group transformations would interfere with the path effect.

September 23, 2018, 07:06:36 AM
Reply #4

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
Thank you all for your suggestions. I will have a go at each and report back - hopefully having successfully achieved my goal.

Brynn - After I vectorize the image, I actually end up with 7 paths in a group and have suspected this might be the route of my problems - as confirmed by Lazur. The weave\knit pattern from the fabric is being traced - albeit not 100%, but enough for my purposes. I actually need to perform this process with multiple fabrics ranging from fairly plain to very visually complex patterns and although I could draw\recreate some of these fabrics, I wouldn't be able to for all of them, and would prefer to have the "bitmap traced"natural fabric look and feel for the final outcome - if it is possible.

  • 0.92
  • MS Windows 10 Home (10.0.17134)

September 23, 2018, 11:57:39 AM
Reply #5

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Pattern along path is limited to one path only  as far as I know.

Groups are allowed with the extension, but not with the LPE.  In the extension, groups, shapes and clones are allowed, for the pattern.

Given that the texture of the fabric needs to come through, I'm not sure if what you want can be done at all.  For curves any tighter than what you've showed us, I would have to say it's just not possible.  It might be possible for that gentle curve.  Possibly with a lot of tedious work with the Node tool. 

I'd really have to show you what I have in mind, rather than try to explain it.  If you could share an SVG file with the traced image, I could use that to make either screenshots or maybe a video.  In case you want to search on your own, I'm thinking of something called "node sculpting".  But I'd be glad to show you how.

Hhmm, I wonder if a 3D editor might help with this?  I wonder if it might be better at capturing the texture??  I don't really know if it might, but just kind of thinking out loud.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 24, 2018, 07:29:05 AM
Reply #6

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
Hi Brynn,

I have had some success with Lazur's suggestion "path effects/bend path effect" and promptly run into another seemingly - should be simple, problem. I can't seem to figure out how to delete the overhang in Inkscape. Although I am able to export it as a png and delete in other applications.

I have attached an svg with some test fabrics and a png of the desired outcome. Any assistance in either achieving a better outcome or a smoother\easier process would be appreciated.

I did come across another of your posts on another forum where you suggested GIMP to someone after some warping effects on images... would GIMP be a better solution for my task?Fill Test.png
*Fill Test.png
(34.4 kB . 400x400)
(viewed 404 times)
  • 0.92
  • MS Windows 10 Home (10.0.17134)

September 24, 2018, 07:39:23 AM
Reply #7

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
Oops! Forgot one.Fill Test1.svg
*Fill Test1.svg
(1048.34 kB . 400x400)
(viewed 409 times)
  • 0.92
  • MS Windows 10 Home (10.0.17134)

September 24, 2018, 11:34:27 AM
Reply #8

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
If your final results need to be vector paths, then GIMP would not be helpful.  GIMP is a raster editor.  I'm not sure which message you might have seen (I've been around this community for over 10 years!).  I do recall a couple of times recommending GIMP for people who want to warp a photo around a sphere.  I think GIMP has a tool to do that.

It should be relatively easy to trim off those edges using clipping.  However, the pillow object has also been traced, which means that it's not a single path.  Instead, it's made of 2 paths - inner and outer, sort of.  So you'll need to prepare a proper clipping path.

 -- Select the pillow path
 -- Duplicate (Edit menu or this button  :dup: )
 -- Path menu > Break Apart (everything is going to go black when you do that, but don't worry)
 -- don't deselect anything

The next steps are optional, but they might help you to see what you're doing, while you're learning.  Once you've done it a few times, you could skip these steps:

 -- Object menu > Fill and Stroke > Stroke Paint tab, click the solid colored, square, blue button :fc: (this adds a stroke, or outline, although you probably can't see them yet)
 -- Choose some wild bright color for the new strokes.  It will help you to see them easily, on top of the black pillow outline.
 -- Object menu > Fill and Stroke > Fill tab, click the big X button  :rem: (this removes the fill)

So now you can easily see the paths.  My guess is that you'll want to use the inner path for clipping.  If you use the outer path, then the fabric is going to look like it's on top of the pillow outline.  Using the inner path will make it look like the fabric stops at the pillow outline.  But you can experiment with them to find out which one works best.

Whichever path you decide to use, select it and the fabric object at the same time.  (If you haven't already learned, holding the Shift key will let you select both objects at the same time.)  Then just do Object menu > Clip > Set

Don't forget to delete the other path.

Let us know how it goes  :)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 25, 2018, 08:28:46 AM
Reply #9

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
It works brilliantly for cutting out the overhangs at the top and bottom, however when I have tried the same process with the vertical - slightly curved paths, the results are not the same. Is their something I'm not doing right?

Again, many thanks for your assistance.
  • 0.92
  • MS Windows 10 Home (10.0.17134)

September 25, 2018, 10:08:54 AM
Reply #10

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
I have hit upon a workaround, which is to make a single path enclosed path - similar to that in the svg I sent you, to clip around all of its edges.
  • 0.92
  • MS Windows 10 Home (10.0.17134)

September 25, 2018, 09:46:58 PM
Reply #11

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
I'm afraid I don't understand what the problem was with clipping, on the first try.  What "vertical - slightly curved paths" ?

Maybe you didn't have the entire group (the traced fabric object) selected on the first try?  Otherwise, there's only one object there with vertical curved paths.

Edit - Unless you mean the black paths that are underneath the trace fabric object?  But those don't overlap the pillow outline.

And then the next message is equally confusing.  You should have had only one single closed path, from the steps I gave.

But, if you're happy with the results, then I 'm happy  :D
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

September 27, 2018, 06:16:18 AM
Reply #12

wealdstoner

  • Sr. Newbie

  • Offline
  • **

  • 7
Brynn,

My Apologies for the confusion. The file I sent you had a basic pillow image with one strip... in which the fabric only overlapped the pillow outer edges. In reality and to speed things up, once the "Bend" tool had been used, it was sufficient and quicker to position the fabric loosely over the area to be covered and to clip around all the edges - rather than try to fit the width accurately and only have the top and bottom requiring clipping.

I was actually trying out your instructions on my final project and the pillow in that was the cause of my problems. Once I had created single paths for each enclosed area I wanted to fill with fabric, your instructions worked like a charm - much easier and quicker than I could have expected.

Thank you for your help. It really was appreciated.
  • 0.92
  • MS Windows 10 Home (10.0.17134)