Page 1 of 1

Erase only WHITE lines?

Posted: 10 May 2017, 11:06
by Sewie
Dear TVP friends,

I'm trying to create a eraser that will only erase WHITE lines, but I'm at a loss. I tried to adjust one of the opacity erasers ('erase only black lines' for example) by fiddling with the george code for the color, but I get very strange results... Can someone help me or explain what I can do to achieve such a result?

Re: Erase only WHITE lines?

Posted: 10 May 2017, 11:14
by slowtiger
What's the context? If it's only black and white lines, I'd use Scan Cleaner.

Re: Erase only WHITE lines?

Posted: 10 May 2017, 13:29
by schwarzgrau
I made you one (the icon is still wrong). I still don't know how this colorcodes work, but I just looked at the color codes from the other magic erasers and try to combine them in some way.

tv_custommode 0 0 0 0 0 0 1 0 0 0 0 0 1 0 0 -1 0 0 1 0 (red)

tv_custommode 1 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 -1 0 1 0 (green)

tv_custommode 1 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 -1 1 0 (blue)

tv_custommode 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 0 -1 1 0 (white)

I'm really not sure if it works as good as the other, but it seems to work.
Maybe the TVPain team could tell us how the color codes really work or change them to something more common like RGB.

Re: Erase only WHITE lines?

Posted: 10 May 2017, 19:56
by Sewie
Thank you so much, Marc (Rühl)!

I found this Wiki page but I couldn't make it out properly. Did you use trial and error to find the code for white? I can see where you activate all the red, green and blue channels but 'm not clear on how you figured out how to create white. The trick is in those last 5 digits, isn't it...?
slowtiger wrote: 10 May 2017, 11:14 What's the context? If it's only black and white lines, I'd use Scan Cleaner.
It's for sketching with black and white lines on a tinted background. It'd be handy if I could erase both colors separately.

So I've made an icon for the white eraser. Now you can recognize it easily in the interface:
WiteEraser_Icon.PNG
WiteEraser_Icon.PNG (2.05 KiB) Viewed 40805 times
WhiteEraser - Mike.zip
(2.02 KiB) Downloaded 1184 times

Re: Erase only WHITE lines?

Posted: 10 May 2017, 22:04
by Svengali
Another option which seems to leave no fringing (works like a scan cleaner brush) :
scan-cleaner-brush.jpg
scan-cleaner-brush.jpg (6.4 KiB) Viewed 40736 times
Sven

Re: Erase only WHITE lines?

Posted: 11 May 2017, 02:20
by o0Ampy0o
Sewie wrote: 10 May 2017, 19:56 It's for sketching with black and white lines on a tinted background. It'd be handy if I could erase both colors separately.
Whenever I think of drawing with similar material I think of Perre-Paul Prud'hon's work.

Image

Head of Vengeance from the collection at the Art Institute of Chicago.

Re: Erase only WHITE lines?

Posted: 11 May 2017, 10:06
by Sewie
Svengali wrote: 10 May 2017, 22:04 Another option which seems to leave no fringing (works like a scan cleaner brush) :

tv_custommode -1 0 0 0 0 0 -1 0 0 0 0 0 -1 0 0 0 0 0 0 -1 1 0 (white)

Sven
So, Sven, what is the rationale behind finding that color code? How did you decide on this...? Might be good for us to learn a little about the basics of George.
I'm asking because frankly I find that Wiki Page I linked a little cryptic.

Edit: Btw, pasting your code into the brush's properties does not work, it leaves me with a regular vanilla eraser brush. Schwarzgrau's brush works perfectly, though.

o0Ampy0o wrote: 11 May 2017, 02:20
Sewie wrote: 10 May 2017, 19:56 It's for sketching with black and white lines on a tinted background. It'd be handy if I could erase both colors separately.
Whenever I think of drawing with similar material I think of Perre-Paul Prud'hon's work.

...

Head of Vengeance from the collection at the Art Institute of Chicago.
Wow!

Re: Erase only WHITE lines?

Posted: 11 May 2017, 12:33
by schwarzgrau
Sewie wrote: 10 May 2017, 19:56 I found this Wiki page but I couldn't make it out properly. Did you use trial and error to find the code for white? I can see where you activate all the red, green and blue channels but 'm not clear on how you figured out how to create white. The trick is in those last 5 digits, isn't it...?
Hehe yea kind of trail and error. Honestly I was surprised too, cause none of the colors is really "pure". Like pure blue or pure green. But somehow it worked. And to be honest I have absolutely no idea what the last 5 digits do. I checked the wiki page too a few month ago and couldn't figure it out. But I'm glad it worked and I could help.
Sewie wrote: 10 May 2017, 19:56 So I've made an icon for the white eraser. Now you can recognize it easily in the interface:
WiteEraser_Icon.PNG
Oh great, this way it will fit nice in my custom panel.


EDIT: Maybe even if the colors are not pure, the eraser still works, cause one of the numbers (maybe the last one) is some kind of threshold. So the code I used isn't really pure white, but kind of and the threshold makes it work with white.
No, I've tried something and it seems to be wrong.

Re: Erase only WHITE lines?

Posted: 11 May 2017, 18:43
by Svengali
Sewie,
I updated the numbers in my previous post with a screen capture... try substituting those again.
The forum editor removes spaces making the parsing of the r g b a k values run together.

I know absolutely nothing about manipulating pixel color matrices. But my logic in this specific case (removing white and leaving black using the pixel matrix) went something like this:

Each of the inserted -1 values for Red r, Green g and Blue b removes those component colors, which combined = white.
As to the 0 0 -1 1 0 for Alpha section? Not sure but I think g = 0 removes the green alpha channel, r = 0 removes the red alpha... channel b = -1
sustains the existing opacity percentages of the solid black and partial black areas. the a = 1 makes the pixel retain the previous alpha value for each area.

Maybe Eric Scholl can clarify about -1 used in pixel color matrices.

Sven

Re: Erase only WHITE lines?

Posted: 11 May 2017, 21:12
by Sewie
Svengali wrote: 11 May 2017, 18:43 Sewie,
I updated the numbers in my previous post with a screen capture... try substituting those again.
The forum editor removes spaces making the parsing of the r g b a k values run together.

...
Sven,
Just tried it again, exactly as you said, and I'm telling you: it erases everything.
Have you tried it yourself?

Re: Erase only WHITE lines?

Posted: 12 May 2017, 03:23
by Svengali
Sewie,
Seriously? I ALWAYS test out suggestions I make or buttons/scripts I create. Only then do I post, after I know they work on MY system.

Here's a video of how the eraser works for me along with my version of the brush...
Scan Cleaner Brush Demo.gif
Scan Cleaner Brush Demo.gif (5.31 MiB) Viewed 40718 times
EDIT: note that the Scan Cleaner Brush has been updated so that it CORRECTLY CONVERTS any and all color pixels as well.

Re: Erase only WHITE lines?

Posted: 12 May 2017, 07:01
by Eric Scholl
There is already some explanations about pixel matrix here : http://wiki.tvpaint.com/index.php?title=Tv_PixelMatrix
By the way, the script is working here : it erases the white, but for other colors, the more the color is close to white, the more it will be transparent.

Re: Erase only WHITE lines?

Posted: 12 May 2017, 07:55
by Sewie
Svengali wrote: 12 May 2017, 03:23 Sewie,
Seriously? I ALWAYS test out suggestions I make or buttons/scripts I create. Only then do I post, after I know they work on MY system.

...
Sorry to have insulted you, Sven. I've downloaded your brush and it works perfectly.

I think my mistake was with the spaces between the digits, as you mentioned, but I assumed it was 1 space between the digits and 2 between the digits of the color groups. But it's 2 spaces between digits and one EXTRA (so 3 spaces) between the color group digits.

Eric, I've looked at the link you posted but as I mentioned earlier in this thread, I find it very cryptic. It doesn't clarify to me how the color coding works...
Could you please explain some more?

Re: Erase only WHITE lines?

Posted: 12 May 2017, 12:06
by Svengali
Sewie, No problem...

I need to say that, while the Scan Cleaner version of the white eraser brush works, I'm still not sure why.

I do know from tests that the -1 in the blue alpha position is what makes it work... alternately, It also works if -1 is placed exclusively in the red alpha or the green alpha position instead.

But if my version of the Scan Cleaner brush is applied to any color pixel areas, the blue component of each affected pixel is erased. I could not find a combination of values that would erase white and leave the color pixels intact.

Bottom line, the Scan Cleaner version is only effective for use with black, gray and white images.

Sven

Edit: Success! After further testing... the new version of Scan Cleaner Brush (down load above) now correctly converts any and all color pixels.