Inkscape gradients


#1

I’m trying to create a gradient in inkscape for the edge of a sign that I am making. I’m trying to create a slightly cartooney weathered wood effect. I want the purple area in the below image to be a gradient from white (no engrave) to black (deep engrave)

I’ve tried using interpolate to create many layers between the two which could each be colored differently to get the effect, but it creates a strange spirograph like patterns where some of the lines cross over each other in ways that won’t work.

Anyone know of any way to get the proper gradient?


#2

You can create one closed shape, no stroke and use a black to white gradient fill in it (using colors doesn’t generally work as well with gradients.)

BUT…you will also have to rasterize the gradient (go to Edit > Make Bitmap Copy, then delete the vector underneath it). The GFUI can’t process vector gradients yet. They have to be rasterized.


#3

Jules is spot on but if resolution is important to you I’d stay away from the bitmap copy method and use export as png instead.

EDIT – Previously:

@jules and I had almost exactly this conversation months ago.


#4

As long as you set the bitmap copy resolution in the settings for Inkscape, resolution shouldn’t be an issue. By default its set at 96 dpi but you can increase that to whatever dpi you want by going into Edit -> Preferences -> Bitmap and changing the dpi for the setting Resolution for Create Bitmap Copy.


#5

Messing with default DPI is a bit more than I want to do1 to simply export the png. PNG exporting has a much more robust set of options and serves as a way for me to keep an archived copy of the raster, something that works well for my workflow; I can now use Gimp to modify it freely before pulling it back into the SVG, should I need to. This can be essential to getting a pure white-to-black gradient using curves.

So, like I said, if resolution is important, exporting pngs has some benefits over the simple raster copy. I personally find 96 dpi to be insufficient – it is visibly jagged – but if it works for your project, have at it… it all depends on your needs.

1 Given that DPI in SVGs can cause major scaling issues with the GFUI, I tend to avoid anything that messes with it. I doubt this would cause it, but I’m just not going to modify it. Besides, the preferences dialog is a pain to navigate in Inkscape. Preferences? Document Preferences? Vague section headers, like “behavior”? Nah. Export as PNG and move on, I say, but ymmv.


#6

I agree with this, I find 96 dpi to be extremely lacking but like I stated, you set it once in the settings and the only thing it changes is what DPI it uses when you use the Create Bitmap Copy function. I have mine set to 600 DPI as I’ve found that to be good for most projects I do. As a note, when you make a bitmap copy, it also saves the bitmap separately in the same folder as your original file. I understand that you have your way of doing things, I was just explaining to the OP that using the Create Bitmap Copy function can produce results with whatever resolution you want as long as you set it to do so.


#7

Working with gradients that have to be bit-mapped anyway I find it best to go to Gimp, If you need outlines you can import .Svgs into Gimp and it will ask you the scale which you make very large.

Gimp will then fairly easily turn areas into masks and then masks into paths that you can use to go back to that mask at any time. Now you have much more power to do all kinds of things as Inkscape is very primitive at manipulating bit-maps.

you can as example open a new layer and have a brush paint along a path with multiple colors and gradients. If I have a shape that I want to engrave nice rounded edges that gradiant following a curve is a good way to go.


#8

Okay, got home from work and was able to try out the first suggestion, and I now realize that I wasn’t very clear with exactly what I was trying to do. I need the gradient in the purple area to be white everywhere where it borders on the white inside area, and black all around the outside. Not a simple fill from left to right or inside to outside or anything like that.

I’m trying the strategy of importing my shape into gimp, but i’m having trouble getting it to good enough resolution to work with. I’m also not really following how to achieve the desired result in gimp.

Anyone able to help?


#9

You’re talking about a glow and blur technique. Google for that.


#10

Typically the SVG might want to import at 500px or so but I would use 10,000 or so and then back in Inkscape scale it back down.


#11

I don’t think I can do what I need with glow/blur either. I need the black spiky lines that cut into the purple area to remain fully black, but they get washed out with the glow/blur technique.

I managed to import it into gimp, but I still can’t find any way to do what I need in gimp either.

The only way I could see to do it would be with a mesh gradient in inkscape, but from the little time I spent messing with mesh gradients, it seems like I would have to create like a 20x20 grid and then it would be hours of aligning all the nodes and each of their 4 little influence tab things… I’m not sure it’s worth doing that much work. I really thought there had to be a fairly simple way to do it, but at this point it appears there isn’t. Thanks for the help anyway everyone


#12

Ok! I walked through several examples of things to know If I got a bit silly at the end.

First you open the svg in gimp and get a lot of options:
shad-1
This one was big to start with but 1600 or 1800 x value up to 10,000 will give a lot of resolution. Import paths turn vector lines into Gimp paths, merge paths makes them all one and not as useful usually.

You can build selection sets easily enough yourself of course, and put new paths along those selection sets as in:

Once I had a path edit filled the shapes in white for a gradient curved engrave.
In several places you can paint along a path an even use a gradient brush, along the path will only paint inside the selection or in the selection window paint along the selection that will paint both sides of the line

I then used Blur for an even curve:

A quick invert of the selection (note the selection editor at the bottom that is the second Image)

Add a new layer(from visible)

Fill that with the blackground:

and blur (feather) the mask:

I started thinking that even the gradients could have gradients so the blurred mas gradient could be applied to a general gradient!

you can read the pulldown or window and see a dozen other ways to go at each point so you need to try them all :upside_down_face:


#13

BTW if you really want to get a weathered wood look, you can always find a picture of weathered wood and just engrave that. Someone once engraved woodgrain to pretty good effect, lets see if I can find it.

Nope! Lost to the ether of discourse, maybe someone else knows which post I mean. They took a piece of plain wood and engraved a strong grain pattern on it, it looked pretty good.


#14

veryoldwood


#15

It was @jbmanning5, after I did an entry sign on a piece of old cedar fencing:


#16

Here are some more photos, if anyone else wants to try it:


#17

Yup, that’s the one. Nice :slight_smile:


#18


Here’s my finished product, if anyone is curious. I think I should have made the effect a little stronger, but overall I’m happy with the result