Color replacing in a selection made with smart brush

Corel Paint Shop Pro

Moderator: Kathy_9

Post Reply
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Color replacing in a selection made with smart brush

Post by ilgk48 »

Good afternoon to all.
I've just realized a behaviour of the ColorReplacerAll that I do not understand.
In this image I have done two selections: at the left with the classic rectangular instrument at right with the smart brush
Screenshot (11).png
Now I use the ColorReplacerAll for transforming the background color (255,255,247) in red (255,0,0).
Screenshot (12).png
At the left I see my expected result: the selection is interely filled in red. But in the right selection the pixels on the border are not red: why?
Wich parameters do I change for obtaning the right selection completely red?

Morever I have noted that inverting the selection the border line at the left remains there while the border line at the right seems to collapse inward ... mumble.
Screenshot (13).png
Thank you very much.
Paolo
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Color replacing in a selection made with smart brush

Post by Jean-Luc »

Why do you use Smart Brush?
Use the Magic Wand Tool and Fill Tool.
I don't understand why you need to enlarge your image to 2500%?
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Re: Color replacing in a selection made with smart brush

Post by ilgk48 »

Hi,
the enlargement has the purpouse of highlighting what happens.
Regarding the instrument, it has to be the color replacer.
You have to know that the problem I have posted is equivalent to the real problem that I encounter in my use of PSP for cleaning the pages of some old magazines.
Solving or understanding the problem posted means, for me, to solve and understand the real problem ... even just for curiosity :-).

Paolo
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Color replacing in a selection made with smart brush

Post by Jean-Luc »

ilgk48 wrote:But in the right selection the pixels on the border are not red: why?
Because the Color Replacer tool replaces all pixels containing some white. Pure white is painted with pure red, less white with less red. Use Tolerance control to lower the sensitivity.

I suppose you have a page with text. When I scan, I set the scanner at 600 DPI and never save in JPG format. JPG produces artifacts around the letters. By artifacts, I mean pollution of grey or near white pixels coming from the letters and surrounding the letters due to the JPG compression.

You may "clean" the page with the Histogram Adjustment tool. Could you post a crop of such a page?
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Re: Color replacing in a selection made with smart brush

Post by ilgk48 »

Mumble :-),
Coror replace, replaces all pixels with some white, in pixels with less red you say. OK but this is not true in the left selection where all pixels are changed in red. Moreover, also in a selection made point to point, the Replacer replaces all (255,255,247) of the background into pure Red: I've just verified.
The question arises in the selections made with the Smart Brush.

Very interesting the hint of scanning without converting in jpg. I have to check, but for now I have all images in Jpg at 300 dpi. The limits of my "home technology" do not permit the scanning and the editing of images at 600 dpi. I have 4 GB RAM and with images at 300 dpi (compression at level 1) of about 4.5 - 5.5 Mega PSP suffers.

My goal is the restoring of old magazines, I said. Well: every magazine has at least 50 pages and (for now I've scanned about 50 issues using a flat Canon Scan 4400F).
With some massive VBA procedures in Excel and some scripts in PSP, I do a first manipulation of the scanned pages (renaming, yellowing removal, Moire reduction).
Then I manually straighten and crop in left right every images (50 or more for an issue, I repeat).
End of the first phase :-)
Now the cleaning.
Here is the crop of one page after the first phase.
OrigTest1195905_009.jpg
Just a note: the magazines treat aeromodelling matters.
Every page requests it's personal approach
The general goal is to smooth, tendentially, the background to (255,255,247) (not pure white) preserving and eventually HihgLighting pics and drawing.
In this case I wish to protect the figure of the man and the discs of the propellers.
Set at a convenient dimension, the Smart Brush is for me the quick and simple method for creating a selection around them.
Then I reverse the selection and with a PSPscript I transform in pure Red all the annoying grays or similars that disturb the image. In this way I obtain a sort of panoramic prewing of where the cleaning will act. The cleaning consists in transforming the red in (255,255,247) with no tolerance.
But here arises the problem of the Smart Brush: along the border (but not everywhere) of the selection made with it, many undesidered pale red pixels remain.
Selecting point to point do not cause the problem but ... click, click, click, click ... is frustrating and irritating for me.
Magic Wand? click, click, click and again click ... No (see above :-) )

In conclusion I do not want correct the colors using istogram but i want reduce the undesidered colors to the background color that I have choosen. In fact, many disturbing colors are shadows coming from the back of the page, but the scanner do not know this :-). And it is funny when the "redding" PSPscript reveals, reversed, the text on the backside of the page.

Thank you for the patience in reading all this.
Paolo
User avatar
hartpaul
Advisor
Posts: 2893
Joined: Tue Mar 20, 2012 3:38 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUSTeK P7P55D STRIX B240F GAMING
processor: IntelCore i7 7700 3.60 Ghz
ram: 8 Gb
Video Card: Nvidia GeForce GTX 1050
sound_card: Nvidia High Definition Audio
Hard_Drive_Capacity: 1000 Gb
Monitor/Display Make & Model: AOC
Corel programs: PSP8,X2 to X9,2018,2019,2020
Location: Australia

Re: Color replacing in a selection made with smart brush

Post by hartpaul »

I tried a different way using Split Image , a mask to obtain a clean result. Not very automatic and each page will require quite a bit of work.
1. Duplicated the original image and hid the background.
2. Dragged the top thumb onto the desktop to make a copy of the image.
3. Applied Levels and Brighten / Contrast to darken and increase the contrast so the propellers were considerably darker.
4. Image . Split Channel to RGB. Chose the Green channel image - discard the red and blue channel images.
5. Used Adjust > Brightness and Contrast > Threshold to get a pure black and white image
6, Cleaned up edges and black spots and white spots with paintbrush set to black or white. That produced this image which I then use as a mask
Green6Mask.jpg
7. Mask > From Image used that green image Not sure of the exact steps but I think I reversed the mask so that all the white areas transparent. Then used the magic wand to select those areas and flood filled with your 255,255,247.
8. Selections none and this was the result. (I think the image had to be merged as some point as well) .
Result.jpg
Systems available Win7, Win 8.1,Win 10 Version 1607 Build 14393.2007 & version 20H2 Build 19042.867
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Color replacing in a selection made with smart brush

Post by Jean-Luc »

ilgk48 wrote: i want reduce the undesidered colors to the background color that I have choosen. In fact, many disturbing colors are shadows coming from the back of the page,
It is a common error made by users when scanning.
If you don't want the back side be visible, place a black cardboard/paper behind the page when scanning.
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Color replacing in a selection made with smart brush

Post by Jean-Luc »

ilgk48 wrote: I do not want correct the colors using istogram
I didn't say to correct colors. Histogram adjustment is mainly for Luminance, Contrast, Softness and may be used for colors too.
You can clean the light grey background if you remove those pixels using the Histogram:
Histogram Luminance 1.jpg
Histogram Luminance 2.jpg
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Re: Color replacing in a selection made with smart brush

Post by ilgk48 »

Jean-Luc wrote:
ilgk48 wrote: i want reduce the undesidered colors to the background color that I have choosen. In fact, many disturbing colors are shadows coming from the back of the page,
It is a common error made by users when scanning.
If you don't want the back side be visible, place a black cardboard/paper behind the page when scanning.
You are right. I tried, but unfortunately this requires a surplus manipulation of the magazines. They are very fragile and the inserting of a cardboard is too invasive. The risk of an unwanted dismantling or tearing is high.
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Re: Color replacing in a selection made with smart brush

Post by ilgk48 »

hartpaul wrote:I tried a different way using Split Image , a mask to obtain a clean result. Not very automatic and each page will require quite a bit of work.
1. Duplicated the original image and hid the background. ecc. ecc.
Thank you very much. Your result is very good. :-)
My cleaning process contains just a very rough and naive attempt for creating a mask. Now I have to masterize your process for evalueting the effort needed. Maybe some automatisms are possible.
Paolo
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Re: Color replacing in a selection made with smart brush

Post by ilgk48 »

Jean-Luc wrote: I didn't say to correct colors. Histogram adjustment is mainly for Luminance, Contrast, Softness and may be used for colors too.
You can clean the light grey background if you remove those pixels using the Histogram:
Hi Jean-Luc,
I'll try with Histogram.
You have to know that I'm not a photographer, nor a painter or an artist. I'm a computer programmer and I'm reasoning and using PSP as a computer programmer.
For me the greatest lack of PSP :-) is the absence of an API (at least I have not found it) for directly accessing the pixels of an image. Something like GetPixel(x,y).

For me, moreover, the fundamental question remains why in the interation between a selection made with Smart Brush and the Color Replacer, the pixels on the border are not treated as the pixels in the inside.
But nobady is giving a technical answer to this question :-).

Paolo
Jean-Luc
Advisor
Posts: 2177
Joined: Sat Oct 22, 2011 10:50 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
motherboard: ASUS Computer N751J
processor: Intel i7_4710 HQ 2_50GHz
ram: 16GB
Video Card: NVIDIA GeForce GTX 850M
sound_card: NVIDIA High Definition Audio
Hard_Drive_Capacity: 2 Tb
Monitor/Display Make & Model: NVIDIA GeForce GTX 850M
Corel programs: PSP X7, X9, 2018 to 2023
Location: Belgium (French speaking)
Contact:

Re: Color replacing in a selection made with smart brush

Post by Jean-Luc »

ilgk48 wrote:or me, moreover, the fundamental question remains why in the interation between a selection made with Smart Brush and the Color Replacer, the pixels on the border are not treated as the pixels in the inside.
When using Smart Selection Brush, Feather and Anti-alias may create semi-transparent pixels along the edge of the selected object.
THE PAINTSHOP PRO COOKBOOK - GENEALOGY WITH PAINTSHOP PRO
Installed PSP Ultimate: X7, X9, 2018, 2019, 2020, 2021, 2022, 2023
ilgk48
Posts: 63
Joined: Sun Apr 28, 2019 12:26 pm
operating_system: Windows 10
System_Drive: C
32bit or 64bit: 64 Bit
Corel programs: PaintShop PRO 2019 32bit

Re: Color replacing in a selection made with smart brush

Post by ilgk48 »

Jean-Luc wrote:
ilgk48 wrote:or me, moreover, the fundamental question remains why in the interation between a selection made with Smart Brush and the Color Replacer, the pixels on the border are not treated as the pixels in the inside.
When using Smart Selection Brush, Feather and Anti-alias may create semi-transparent pixels along the edge of the selected object.
Yes Jean-Luc, you are right. Moreover I say that even if you set Feather = 0 and NO Antialias Smart Brush creates, anyway, some semi-transparent pixels along the edges.
This semitransparent condition disappears when you reset the selection. But if before resetting you save the selection, reloading it after the resetting makes the semi-transparency return !!!
I stop here :-).
Thank you again for your hints.
Post Reply