Add an alpha gradient to a pattern.

Post questions on how to use or achieve an effect in Inkscape.
User avatar
LiquidAsh
Posts: 71
Joined: Fri Apr 22, 2011 11:35 pm
Contact:

Add an alpha gradient to a pattern.

Postby LiquidAsh » Thu Aug 16, 2012 6:02 am

Is there a way to make a pattern fade way near the edges? The fill dialog makes it look like patterns and gradients are mutually exclusive, but I thought I'd ask whether anyone knows a way of applying a gradient alpha channel on top of a pattern. This might be beyond the scope of inkscape (although I'm not sure how to do it in gimp either: blending the alpha channels of two different images).

User avatar
Grobe
Posts: 411
Joined: Tue Feb 02, 2010 2:20 am

Re: Add an alpha gradient to a pattern.

Postby Grobe » Thu Aug 16, 2012 8:52 am

Hi.

As far I've tested that can't be done.

However, if you really need to set opacity to a gradient you can put it into a separate layer. But I'm afraid I cannot help you add a proper alpha to the pattern.
:lol:

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Add an alpha gradient to a pattern.

Postby brynn » Thu Aug 16, 2012 12:01 pm

There might be a filter that does this, sort of, but probably not exactly what you need. You might be able to use interpolation to fake a sort of feathering effect, if it was a solid colored object. But with a pattern fill, it wouldn't work. What about a mask? It wouldn't change the pattern fill, but instead, mask it.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Add an alpha gradient to a pattern.

Postby druban » Thu Aug 16, 2012 12:17 pm

LiquidAsh wrote:Is there a way to make a pattern fade way near the edges? The fill dialog makes it look like patterns and gradients are mutually exclusive, but I thought I'd ask whether anyone knows a way of applying a gradient alpha channel on top of a pattern

I was able to do this quite easily, LA, is there a specific problem you are having that you could explain?
rect5349.png
rect5349.png (100.99 KiB) Viewed 6568 times

Have you tried to get what you want with tiled clones? These will accept gradients in the original and remain editable in the copies.
Off topic:
LiquidAsh wrote:although I'm not sure how to do it in gimp either: blending the alpha channels of two different images

are you familiar with layer masks? These are alpha channels for each layer in an image.
Last edited by druban on Thu Aug 16, 2012 6:36 pm, edited 2 times in total.
Your mind is what you think it is.

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: Add an alpha gradient to a pattern.

Postby Xav » Thu Aug 16, 2012 5:06 pm

I interpreted the question a bit differently to druban, so here's my suggestion. One of us is bound to have got the right idea ;)

I would do this with a mask. You will have one object containing your pattern, and another (possibly a group) containing elements of black, white and grey to use as a mask. I chose the sand pattern (with a bit of a wink - it gets used in almost all our comic strips!), and then created a group of two rectangles, one black, and one white. The white one was blurred.

Then I made clones of my object and group, aligned them, and ensured that the group (mask) is on top. Select them both and then right-click > Set Mask.

You could do this with the originals rather than making clones, but by using clones it's easier to modify the originals and immediately see the effect, rather than having to release the mask then re-set it. Once you're happy with the effect you can re-do it with the originals if you want.

I've attached the SVG so you can download it and play around with the shape and fill of the top row to see the effect at the bottom.
Attachments
pattern_and_mask.svg
(110.46 KiB) Downloaded 270 times
pattern_and_mask.png
pattern_and_mask.png (112.38 KiB) Viewed 6582 times
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Add an alpha gradient to a pattern.

Postby druban » Thu Aug 16, 2012 6:25 pm

Yeah, I think Xav has interpreted the OP's request correctly, because now i notice that he said, "patterns and gradients are mutually exclusive..." which they are, because you can only specify one kind of fill for any object.

Off topic:
Incidentally, Xav, what is the purpose of the black rectangle in the mask group???
Your mind is what you think it is.

User avatar
LiquidAsh
Posts: 71
Joined: Fri Apr 22, 2011 11:35 pm
Contact:

Re: Add an alpha gradient to a pattern.

Postby LiquidAsh » Thu Aug 16, 2012 9:34 pm

Yes, it sounds like Xav has nailed it. I've used masks quite a bit, but never with alphas. It sounds like this will work brilliantly. Thanks everyone!

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: Add an alpha gradient to a pattern.

Postby Xav » Fri Aug 17, 2012 2:30 am

druban wrote:
Off topic:
Incidentally, Xav, what is the purpose of the black rectangle in the mask group???


You're right, it's not really needed. I've just got into a habit of drawing masks explicitly using white and black (and the greys in-between) for a couple of reasons:

1) I find it a lot easier to see a translucent white rectangle against a black one, than against the white background of the page :lol:
2) It mirrors the layer masks in The GIMP which uses greyscale images, and in fact doesn't (as far as I can tell) allow transparency on the layer masks at all.


So no real purpose, just habit.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter


Return to “Help with using Inkscape”