Help needed - irregular color gradient in random shape

Post questions on how to use or achieve an effect in Inkscape.
mike0815
Posts: 1
Joined: Fri May 01, 2015 1:34 pm

Help needed - irregular color gradient in random shape

Postby mike0815 » Fri May 01, 2015 2:07 pm

Hi,

i am really desperate because i try to achieve a certain effect since hours and i basically just do not succeed :-(

I need to colorize a random shape with a rainbow color gradient. The tricky thing here is, that the color gradient itself should have a "wave like" appearance. To clarify my problem i made some simple drawings:

A) shows the straight forward thing. Its easy to set up a color gradients, add steps, adjust offset etc. but the thing i need is B)! I need to individually change the course of each color. E.g. i want the turquoise gradient to form such a curve. Consequently i need all the other colours behind also to form that curve leading to an harmonic overall picture. I tried to cut my shape in smaller columns and colorize each one individually (like pictured in C) but i never get a harmonic alignment to the colours of the neighboring columns :-(

Image

The final result should look a bit like that (stolen from the internet) heatmap. Irregular colored like i draw the gradients with the cursor. Of course way to blurry but is shows what i need.

Image

In reality its not a rectangle that i need to colorize but a random shape. I hope that does not play a role for helping me.

Thank you so much
Mike

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Help needed - irregular color gradient in random shape

Postby Lazur » Fri May 01, 2015 8:05 pm

Welcome aboard!

This calls for a gradient mesh, which is not part of the svg standard -so not an officially announced feature.
http://www.inkscapeforum.com/viewtopic.php?f=6&t=18467.

Though if that's for a raster image, you could also hack some other solution, like drawing a simple greyscale image with blur filters, exporting to png, then map another gradient to it, with gimp for example.

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

Re: Help needed - irregular color gradient in random shape

Postby Xav » Mon May 04, 2015 8:31 pm

Off topic:
Lazur, I do wish you would stop telling people that filters are for raster images. Although some filter primitives require the use of bitmaps, most do not, and are just defined using some resolution-independent parameters. The filtering is applied at the point of rasterisation (i.e. during output to screen, printer or PNG file), but that's all.

It's true that filtered vector images won't work in some areas that non-filtered images do - principally things like sending the output to a plotter or vinyl cutter. But that's a limitation of the output device and is nothing to do with bitmap vs vector. Apart from those few "pure" vector output devices, every output device rasterises SVG, whether we're talking about filters, gradients, circles or paths. The filter is just rasterised at the same time, and at the same resolution, as the rest of the image.

I'm concerned that you could be putting some people off the use of filters when they're a perfectly good solution to the problem they have. In this particular case a few blurred objects may be all that's needed to provide the visual effect that the OP is looking for, with no need to export to PNG and further manipulate it in a bitmap editor.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Help needed - irregular color gradient in random shape

Postby Lazur » Mon May 04, 2015 8:54 pm

Off topic:
Don't know which part of my reply made that impression. The suggested gradient mapping is not possible in inkscape with filtering as far as I know, thus I considered exporting as a forced solution.


Hmm maybe that was in the linked topic which is two years old. I can help that, probably a silver silk wallpaper won't be printed in large scale.

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

Re: Help needed - irregular color gradient in random shape

Postby Xav » Mon May 04, 2015 11:39 pm

Apologies if I got you mixed up with someone else. One of the regular posters (and I can't remember who) frequently implies that filters are usually a bad idea because they result in raster images. When you wrote "Though if that's for a raster image..." before suggesting the use of filters, I jumped to the wrong conclusion. Sorry.

In this case, though, I don't see the need for a "map to gradient" function, and therefore no need to move to a raster format. The OP sounds like it's a manual process he's looking for to create a purely visual effect. It looks to me like some blurred coloured shapes will do the job well enough within Inkscape, without the need to move to a raster editor.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Help needed - irregular color gradient in random shape

Postby Lazur » Tue May 05, 2015 3:42 am

My thought was that for a heat map it would be nice to change the colours assigned to each isoline after easily.
(Maybe the swap colours extension can come handy this case.)

Off topic:
In general I'd always prefer a workaround that can be scaled large without problems -if possible-, instead of those that can be a bummer for printing, so maybe it was me.

hulf2012
Posts: 716
Joined: Sat Nov 24, 2012 12:37 pm

Re: Help needed - irregular color gradient in random shape

Postby hulf2012 » Tue May 05, 2015 1:02 pm

Hello,

I'm going to do some "self-marketing" here.

Perhaps in the links above there is a similar tutorial, or a link to This tutorial:


The general idea is, group several paths, blur that group, and then apply a clip-path.
I think that, at least in this case it's better than using the gradient mesh tool. Manipulate the handles of the gradient mesh may be tricky (the last time I tried).

I don't know if mike0815 wants to preserve its image as a vector, or just export it as raster. In the past, I've seen that some filter effects aren't good rendered in all the web-browsers. Just saying.

Greetings

Edit: I was sooo excited to show my tutorial that now I read my own description, I think It may not be the exact recipe the user is requiring. Bluring, grouping and cliping, I truly think needs to be used in the solution, but there is no need to make clones, or create a matrix of patches. The "interpolate attribute in a group" extension will be the key to solve the problem... and reading the Inkscape Guide
If you have problems:
1.- Post a sample (or samples) of your file please.
2.- Please check here:
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/index.html
3.- If you manage to solve your problem, please post here your solution.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Help needed - irregular color gradient in random shape

Postby Lazur » Tue Jul 07, 2015 8:05 pm

Just found this.
So svg filters are capable of gradient mapping, achieving it with inkscape is yet another thing.

v1nce
Posts: 696
Joined: Wed Jan 13, 2010 4:36 am

Re: Help needed - irregular color gradient in random shape

Postby v1nce » Tue Jul 07, 2015 9:31 pm

Lazur URH wrote:Just found this.
So svg filters are capable of gradient mapping,

I don't see how gradient mapping will help here

achieving it with inkscape is yet another thing.

especially when inkscape has no UI for this (plus the feFunc are buggy in inkscape)

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Help needed - irregular color gradient in random shape

Postby Lazur » Tue Jul 07, 2015 9:58 pm

v1nce wrote:I don't see how gradient mapping will help here


You are right, I mixed it up with this similar topic probably.

achieving it with inkscape is yet another thing.
especially when inkscape has no UI for this (plus the feFunc are buggy in inkscape)



The reason of getting back to it is because I came across this clipart, and thought a turbulence filter would look the exact same, if a gradient could be mapped over it.


Return to “Help with using Inkscape”