How do I remove the alpha channel from the air spray filter in Inkscape?

I’m trying to simulate a cloud of data points around a graph and I found that the air spray filter applied to a copy of that graph will give me almost what I want, especially when changing the morphology effect operator from dilate to erode.

result

This doesn’t look too bad, although now the wannabe data points are maybe a bit too weak depending on output resolution. In any case, especially when magnified, you can see another problem:

magnification

Some of the pixels have a really low alpha value which doesn’t make sense in my scenario. I’d like all pixels to have an alpha value of 1.

I tried playing around with the two blend effects the air spray filter contains but to no avail. I then tried to force the alpha channel to 1 using the colour matrix effect with the following setting.

1 0 0 0 0
0 1 0 0 0
0 0 1 0 0 
0 0 0 0 1

But of course this sets everything that has alpha value 0 to 1, too, with a rather devastating effect.

background turns black

Is there a way to turn only the orange pixels non-transparent but not the background?

I know, when exporting this to PDF it’s unlikely that the air spray effect will survive without being rendered as a raster image anyway so I probably could go through that cycle once and then do something to the raster image. But if there is a more elegant way to do this, that’d be great.

Answer

Might be I just found an answer to my own question. It’s not pretty though so actually good solutions are still welcome. You can multiply the alpha channel with some insanely high value, again using the colour matrix effect:

1    0    0    0    0
0    1    0    0    0
0    0    1    0    0 
0    0    0 1000    0

Zero alpha will of course remain so while everything else will be cropped to 1.

crop without visible transparent pixels

Why there aren’t some pixels whose alpha channel was so close to zero that now they are ugly transparent pixels I don’t know. Well, maybe there are but as long as this isn’t visible, I guess I don’t care.

But as I said, this is no solution but an ugly hack so if you know a better way, please feel free to share it here.

Attribution
Source : Link , Question Author : Christian , Answer Author : Christian

Leave a Comment