gotcha

Author Topic: how to use Blend filter  (Read 2048 times)

January 02, 2018, 01:43:33 PM
Read 2048 times

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Hi Friends,
Since I'm about to remove the holiday lights from the forum logo, I started making one for the next holiday, which is Valentines Day  (although I won't apply it until later in Feb).  (If I don't have it ready to go, there's a good chance I'll forget, haha.)  (I'm ignoring a couple of purely American holidays in between.)

I found a layer blend mode which works nicely for changing most of the white to pink.  But the way the forum is made, the logo itself has to have a transparent background.  The layer blend modes require that there's another object behind....oooohh....I just thought of a possible workaround.

But before that, my next thought was to use the Blend filter.  It has 2 options - Background or Image.  So since I can't have anything in the background, I thought I would choose Image.  But it's not clear how to use it.

I exported the rectangle (with a gradient) which was working well with the layer blend.  Then imported that PNG back info my file as an image.  But how do I make that image work for the Image option for the Blend filter?

Simply selecting it, along with the logo, and clicking Apply doesn't seem to work.  Note that I'm using the little Blend dialog, rather the the big filters editor.  Does anyone know how to make it work?

The solution I just thought of, which theoretically should work, is to duplicate the text, and apply the gradient that I was using with the layer blend mode.  Then put that behind.  So it won't show up, but still should be "blendable".

But it still would be nice to know how to make the filter work  :wink1:

(Oohhh!  Just had yet another thought.  What would you all think about opening up the holiday or seasonal decoration to the whole community?  Or could even be a contest?  I'm certainly not all that skilled for this kind of thing.)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

January 02, 2018, 03:05:34 PM
Reply #1

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Hi.

Reading the first part thought the forum layout could use the blend filter.

So it's within inkscape.
The background input works only if you set it up first with the layers panel, otherwise it is ignored. Xav wrote in one of his articles that the image input mode takes "so much resources it needs a special tag for the renderer at the start"... Nothing that special I guess, was facing the same issue when tried to filter a complete layer probably. Oh where was that...hmm... where was it.
Cannot find them. Just open an svg with a changed filter blending mode on a notepad and look for the filter definition of the blending mode for the tag.
It should something to do with the "infinite" filtering area.


The image input is different. That pulls in only an object from the file -select svg element and set it.
If you click on the selected filtered object, you'll end up with an instant crash.
If the image is too complicated, you may end up missing parts.
If the pulled in object is not placed right and the filtering area is not set right, you may not see anything at all.

The pulled in object has it's origin in the top left corner of the page, while for practical reasons -alignment without additional offsetting- the filtered area is better set to be the same as the object.

January 02, 2018, 05:12:24 PM
Reply #2

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Reading the first part thought the forum layout could use the blend filter.

Sorry if I said something confusing?

The background input works only if you set it up first with the layers panel, otherwise it is ignored.

Oh wow!  I thought that couldn't possibly be true.  But it is!  It really rubs me the wrong way when I find things in Inkscape that don't work, and it's already known that they don't work.  Imo, it should not have been added to the stable version, if it doesn't work.

Xav wrote in one of his articles that the image input mode takes "so much resources it needs a special tag for the renderer at the start"

I think I don't have the technical knowledge to understand that.  How does giving it a special tag avoid using so many resources?  What kind of resources - RAM, processor, graphics card?

The image input is different. That pulls in only an object from the file -select svg element and set it.

You mean select the imported image?  Or select the object which you want to have a blend filter?  And then, set what?

If you click on the selected filtered object, you'll end up with an instant crash.

Hhm, no I can't seem to reproduce that....

The pulled in object has it's origin in the top left corner of the page,....

OMgoodness - The Image option totally works, if  I snap the imported image to the top-left corner of the page border.  But it only works for Multiply and Screen - Darken and Lighten don't work.

Also, here's a nice little bug:  Checking Live Preview is actually applying the filter.  And unchecking it does not remove it.  Apparently at one point, I had a couple of objects with the filter applied 6 or 8 times, because of that!  (Although I seem to recall reporting that already, some months ago.)
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

January 02, 2018, 05:26:38 PM
Reply #3

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
You mean select the imported image?  Or select the object which you want to have a blend filter?  And then, set what?
OMgoodness - The Image option totally works, if  I snap the imported image to the top-left corner of the page border.  But it only works for Multiply and Screen - Darken and Lighten don't work.

Also, here's a nice little bug:  Checking Live Preview is actually applying the filter.  And unchecking it does not remove it.  Apparently at one point, I had a couple of objects with the filter applied 6 or 8 times, because of that!  (Although I seem to recall reporting that already, some months ago.)


Oh another false assumption, my bad. Thought you were using the filter editor and not something from the dropdown list.
Was referring to the process of adding the filter primitive, selecting the object and clicking the set button inside the filter editor.
By the results it seems working.
Not sure about the errors of the blending mode and/or how the built-in filter works.
There are plenty more blending options within the filter editor -as the same blending modes are available that the layers can be set to in the layers panel.
Probably that particular filter from the dropdown list is a bit outdated...

January 02, 2018, 07:00:05 PM
Reply #4

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Ah, ok.  No problem with misunderstanding.  As we know, it's part of the internet experience.  However, it seems that a lot of what you said still applies to the built-in Blend (image on top-left corner makes some blends work for Image option, and Background option doesn't work unless you do it first with layers.

Yes I would have guessed there would be more options using the filter editor.  But I tried to use the built-in ones because I was hoping it would make it simpler.

Here's something interesting though, when I put the filter editor into the mix.

(Just to explain, since I don't know the right words.  When you first start a new filter, you have to connect over to the right side, to one of 3 options (Source Graphic, Bg Image, or Bg Alpha) (afaik, the others don't work) (I guess we just like how it looks  :uhoh:).  And I never have figured out why, but at the end, you have to connect over to the right again (not sure if it would be "output").

Ok so use the Background option in the built-in Blend filter.  It doesn't necessarily do anything that you can see.  But a filter is still there.  When you look in the Filter Editor, it shows input is Source Graphic, and the last one (output?) is Background Image.  If you use the Image option, the input is Source Graphic, but the last one (output?) is also Source Graphic.

That seems backwards to me.  Shouldn't it be the other way around?  It seems like the Image option (in built-in filter) should use Background Image option in Filter Editor.

I had the impression the built-in blend filter was new with the recent new blending modes.  But I can't think where or how I got that impression.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

January 02, 2018, 07:34:01 PM
Reply #5

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
There is no output option in the chain link which is a bit confusing.
The bottom-most primitive will be rendered -if it's not connected, it won't show anything -including the unfiltered object...

If there was an output option it should have the filtered area settings, like "final cut" or "clip" -not included with every effect as "general filter settings".

Or maybe you experiencing that you have to connect which input to blend on which input below?
The output is the primitive itself. It's the bottom of the primitive you can connect a new primitive into as an input.


Source alpha should also work although I never used the alpha as an input -seemed more convenient going by the other two working options as alpha can be extracted in easy steps.

The built-in filters are outdated. Like they don't use component transfer primitives, but colormatrices instead.
For example the pixellize filter multiplies the alpha by 1000 instead using a component transfer with 1 for the alpha value in discrete mode. Not a visible difference but the matrix solution is "a bit sloppy". Multiplying with 1000 is not infinite.

January 02, 2018, 10:48:29 PM
Reply #6

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Or maybe you experiencing that you have to connect which input to blend on which input below?

For the record, I'm not actually trying to do anything in particular.  I'm just looking at what happens and trying to understand why.

Here's what I experience:

1 - select an object
2 - Filters menu > Fill and transparency > Blend....
3 - choose 'Image' from Source dropdown
4 - choose any option from Mode dropdown
5 - Apply

That will apply some primitive-less filter.

Open Filters Editor and look at that filter.  It has only the (input) beginning "connection to the right", and the ending "connection to the right".  It doesn't have any primitives.  In the case of using the Image option from Source dropdown, the ending connection goes to Background Image.

Use a different object, and repeat the process.  Except this time, choose Background from the Source dropdown.  When you look at the Filter Editor, you will see that the beginning "connection to the right" is the same as for the first test, Source Graphic.  But for some reason, the ending "connection to the right" goes to Source Graphic.

Is there anything correct about that?  Or is everything just broken?
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

January 03, 2018, 03:58:40 AM
Reply #7

Lazur

  • IC Mentor

  • Offline
  • ******
  • Inkscape Filters Wizard

  • 1,154
  • Gender
    Male

    Male
Ok, now I get it.

The dropdown menu's option generates a filter named Blend. Opened with the filter editor, the names are listed on the left, next to checkboxes and a number showing how many objects have the same filter.

When you select the filtered object, you also select the filter in the filter editor, so the "node-based editor" part of the filter editor panel should be active then.

That is the part saying effects, connections and the listed sources.
Every filter primitives in the filter chain is listed below the "Effects" in a cloumn, one after another.

The Fill and Transparency/Blend... filter only consisting of 1 filter primitive.
The "image" option doesn't really affect any other object in the svg document, it only blends the original object upon itself.

The other option with the "background" is broken as mentioned above -you need a layer with a custom blending mode in the document once to enable it working, though that enabling persists even after such a layer is deleted (if cleanup file/vacuum defs isn't run.)


How to make the real "image" work to use another object in the document.
Create a new filter definition it the left panel where they are listed, name it for example ">>blendimage<<".
Then, at the "Add Effect" list choose "Image" filter primitive.

Select the object you want to pull in from the file and in the "Effects parameters" click the "Select SVG Element" button.
That will show the selected object's id in the effect parameters box, like "#rect3699".
Then, add a blend filter primitive from the Add Effect" as before.

The first connector pulls in the top and the second the bottom input for the blending.
If you want to blend the filtered object on the top of the pulled in object, then the blend primitive's first connector needs to be connected with the source graphic on the right and with the image filter primitive with the second connector.

Then in the filter general settings set coordinates 0, 0 and dimensions 1, 1.


Done.



Now, to apply the custom filter on an object, select the object and tick in the filter definition's box in the filter editor.
Be careful as if you apply this filter on the pulled in object, that creates the instant crash as mentioned above.
-The pulled in object would be blend onto the pulled in object, pulled in again and again in an endless cycle. "Cross referencing".-

Attaching an example with the final result.

January 04, 2018, 12:55:27 AM
Reply #8

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
So it's probably better to avoid using Filters menu > Fill and Transparency > Blend, unless you really know what you're doing.

I'm just going to try using the workaround I came up with, for layer blends.
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann                       

January 04, 2018, 01:37:23 AM
Reply #9

brynn

  • Administrator

  • Offline
  • ******

  • 3,941
  • Gender
    Female

    Female
    • Inkscape Community
Thanks for taking so much time to explain!
  • Inkscape version 0.92.3
  • Windows 7 Pro, 64-bit
Inkscape Tutorials (and manuals)                      Inkscape Community Gallery                        Inkscape for Cutting Design                     



"Be ashamed to die until you have won some victory for humanity" - Horace Mann