Erase only WHITE lines? Topic is solved

Please use this part to report bugs & errors, ask questions & "How to..."
Post Reply
User avatar
Sewie
Posts: 1310
Joined: 18 Jun 2008, 11:57
Location: The Netherlands, Europe
Contact:

Erase only WHITE lines?

Post 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?
Michael Sewnarain - Website
Windows 11/64b Pro - TVP11.7.0 & 11.7.1 - Pro/64b - Cintiq32 Pro - Intel i7-12700K - 64Gb RAM
User avatar
slowtiger
Posts: 2950
Joined: 08 May 2008, 21:10
Location: berlin, germany
Contact:

Re: Erase only WHITE lines?

Post by slowtiger »

What's the context? If it's only black and white lines, I'd use Scan Cleaner.
TVP 10.0.18 and 11.0 MacPro Quadcore 3GHz 16GB OS 10.6.8 Quicktime 7.6.6
TVP 11.0 and 11.7 MacPro 12core 3GHz 32GB OS 10.11 Quicktime 10.7.3
TVP 11.7 Mac Mini M2pro 32GB OS 13.5
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Erase only WHITE lines?

Post 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.
Attachments
WhiteEraser.tvpx.zip
(1.83 KiB) Downloaded 1201 times
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
User avatar
Sewie
Posts: 1310
Joined: 18 Jun 2008, 11:57
Location: The Netherlands, Europe
Contact:

Re: Erase only WHITE lines?

Post 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 41904 times
WhiteEraser - Mike.zip
(2.02 KiB) Downloaded 1235 times
Michael Sewnarain - Website
Windows 11/64b Pro - TVP11.7.0 & 11.7.1 - Pro/64b - Cintiq32 Pro - Intel i7-12700K - 64Gb RAM
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Erase only WHITE lines?

Post 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 41835 times
Sven
Last edited by Svengali on 11 May 2017, 17:33, edited 1 time in total.
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
o0Ampy0o
Posts: 143
Joined: 25 Oct 2015, 22:26

Re: Erase only WHITE lines?

Post 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.
Main System: Mac Mini running OS X: Big Sur | M1 | 16GB RAM | have not installed TVPaint on new M1 need to update to current as of 9/2022 ...pending non-dongle license 1/2023 | iPad Pro, Apple Pencil and Astropad | Wacom Intros Pro
User avatar
Sewie
Posts: 1310
Joined: 18 Jun 2008, 11:57
Location: The Netherlands, Europe
Contact:

Re: Erase only WHITE lines?

Post 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!
Michael Sewnarain - Website
Windows 11/64b Pro - TVP11.7.0 & 11.7.1 - Pro/64b - Cintiq32 Pro - Intel i7-12700K - 64Gb RAM
User avatar
schwarzgrau
Posts: 1238
Joined: 23 Jan 2012, 22:08
Location: Offenbach / Germany
Contact:

Re: Erase only WHITE lines?

Post 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.
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Cintiq 22HD
Windows 11 22H2 / TVP 11.7.0 PRO WIBU / Mobile Studio Pro 16" (2019)
Android 13 / TVP 11.7.0 / Galaxy Tab 7 FE
INSTAGRAM
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Erase only WHITE lines?

Post 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
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
Sewie
Posts: 1310
Joined: 18 Jun 2008, 11:57
Location: The Netherlands, Europe
Contact:

Re: Erase only WHITE lines?

Post 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?
Michael Sewnarain - Website
Windows 11/64b Pro - TVP11.7.0 & 11.7.1 - Pro/64b - Cintiq32 Pro - Intel i7-12700K - 64Gb RAM
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Erase only WHITE lines?

Post 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 41817 times
EDIT: note that the Scan Cleaner Brush has been updated so that it CORRECTLY CONVERTS any and all color pixels as well.
Attachments
ScanCleanerBrush.tvpx
updated 5/19/2017
(94 KiB) Downloaded 1212 times
Last edited by Svengali on 19 May 2017, 09:55, edited 1 time in total.
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
User avatar
Eric Scholl
Posts: 1303
Joined: 04 Apr 2011, 14:40

Re: Erase only WHITE lines?

Post 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.
User avatar
Sewie
Posts: 1310
Joined: 18 Jun 2008, 11:57
Location: The Netherlands, Europe
Contact:

Re: Erase only WHITE lines?

Post 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?
Michael Sewnarain - Website
Windows 11/64b Pro - TVP11.7.0 & 11.7.1 - Pro/64b - Cintiq32 Pro - Intel i7-12700K - 64Gb RAM
Svengali
Posts: 1571
Joined: 28 Dec 2006, 10:08

Re: Erase only WHITE lines?

Post 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.
TVP Pro 11.0.10-64bit Win10 - 64GB ram -2TB HHD - 256GB SSD - Wacom Cintiq 16, driver 6.3.41-1
Android Tablet: rel. 11, Samsung Galaxy Note10.1 - 32GB with microSD 32GB
Android Tablet: rel. 11.5, Samsung Galaxy Tab S7plus - 128GB with microSD 64GB
Post Reply