How to shine B&W background through a shape

Post questions on how to use or achieve an effect in Inkscape.
Gabbianone94
Posts: 2
Joined: Tue Oct 25, 2016 2:38 am

How to shine B&W background through a shape

Postby Gabbianone94 » Tue Oct 25, 2016 3:02 am

Hi everyone,
I have a SVG file containing a map generated by Maperitive. The map is in colors but I'd like that a particular area, which is outside the borders of a certain region, was in shades of grey instead. The map is made of hundreds of lines, nodes and shapes so I can't edit all lines outside the border and change their color to a shade of grey.

So I've created a shape which covers enterely the part of the map that I want to be in shades of grey, and doesn't cover the part which should remain in colour. I thought that there was a setting to make the background shine through the shape in shades of grey, but I couldn't find anythyng.
I only managed to make the background black with 50% transparency which is not what I want because the background shines through in colors though darkened.

Is there a setting to do what I want? Thanks in advance.

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

Re: How to shine B&W background through a shape

Postby Lazur » Tue Oct 25, 2016 3:17 am

Welcome aboard!

Oh such maps can be painful to edit.
The compositing mode change you are asking for is -if there was- implemented by filtering.
By creating a custom filter you can achieve that look.
Theoretically you need to drag in the selected area (drawn with a path) with the image filter primitive, and
by two compositing and a colormatrix filter primitives rigged you can achieve it.
One of the problems is the image filter primitive uses an awkward origin to pull in objects and it is not so trivial adjusting right.
Other problem is if you want to print it in a large resolution pdf -filters need to be rasterized, therefore the vector format may be questionable.
Like, probably it would be easier editing a raster image straight.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to shine B&W background through a shape

Postby Moini » Tue Oct 25, 2016 3:35 am

What I would do is to duplicate the map, clip it (or multiple-cut it) to the area that should be in greyscale, and use an extension that converts the SVG contents of the clipped map to grayscale.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

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

Re: How to shine B&W background through a shape

Postby v1nce » Tue Oct 25, 2016 3:59 am

[fix inkscape bug]
change blend mode of current layer to "blend"
restore blend mode of current layer to "normal"
[/fix inkscape bug]

select the overlay shape. it should have a fill (any colour would do as long as it's not transparent)
go to filers/filter editor
new
add an fx : choose colormatrix and click add a fx
link color matrix to background-image
choose saturation as type in fx parameter

add a new fx: choose composite and click add a fx
the first node should be linked to color matrix by default ; don't change this.
link the second node to source image
chose "in" as operator

done

grey.jpg
grey.jpg (76.76 KiB) Viewed 2808 times

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: How to shine B&W background through a shape

Postby prkos » Tue Oct 25, 2016 1:28 pm

Brilliant v1nce! Thank you!

This one should be added to the filters in Inkscape! Maybe under Overlays? Any more who agree?
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to shine B&W background through a shape

Postby Moini » Wed Oct 26, 2016 7:57 am

Cool :) I can imagine that people would use it 'reversed' - have a grayscale image with colorful 'spots' in it, to emphasize the contents.
I'd rather add it to the 'color' submenu, though.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
prkos
Posts: 1625
Joined: Tue Nov 06, 2007 8:45 am
Location: Croatia

Re: How to shine B&W background through a shape

Postby prkos » Wed Oct 26, 2016 5:47 pm

My logic was that the effect depends heavily on the background behind the object, it's less of an effect done to the object. But Color sounds good as well.

Can a filter decide the objects colors if they are originally in grayscale? I don't see how that would work, although v1nce might save the day again :D

Here is the Wishlist report: https://bugs.launchpad.net/inkscape/+bug/1636723
just hand over the chocolate and nobody gets hurt

Inkscape Manual on Floss
Inkscape FAQ
very comprehensive Inkscape guide
Inkscape 0.48 Illustrator's Cookbook - 109 recipes to learn and explore Inkscape - with SVG examples to download

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How to shine B&W background through a shape

Postby Moini » Thu Oct 27, 2016 12:41 pm

It even works with gradients (opaque to transparent) - so you can fade in the color. Cool stuff! (but it's not always rendered cleanly on the edges of objects, but that's not the filter's fault, of course).

(I never understood the overlays in that sense, as they kind of overlay on the object that has the filter itself - this is different, somehow. But it fits well with the name.)

Bildschirmfoto_2016-10-27_04-33-56.png
Bildschirmfoto_2016-10-27_04-33-56.png (59.97 KiB) Viewed 2682 times
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

Gabbianone94
Posts: 2
Joined: Tue Oct 25, 2016 2:38 am

Re: How to shine B&W background through a shape

Postby Gabbianone94 » Sun Oct 30, 2016 3:02 am

It works! That was exactly what I was looking for! Thank you so much, v1nce! :)


Return to “Help with using Inkscape”