Jump to content

Recommended Posts

Posted (edited)

Hello

I notice a lot of white in my image is not 100% white. If I use a color picker, the values are somewhere around the 240 to 248 for the RGB values. Is there a way to select let's say all pixels in an image that are 235+ for all three values (RGB) and then replace those pixels with pure white? (and of course leave all pixels that have at least 1 value below 235 alone)

Thanks!

Edited by Planetdune
Posted

Someone on this forum showed another user a way to use a Procedural Texture filter to target a range of RGB values in an image but I cant find it at the moment

Hopefully someone else will be able to point you to it

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Posted
3 hours ago, carl123 said:

Someone on this forum showed another user a way to use a Procedural Texture filter to target a range of RGB values in an image but I cant find it at the moment

Here's an example from @lepr:

(Unfamiliar with Procedural Texture, I don't get any change with this specific input … while it generally affects the image with a different setting)

Bildschirmfoto2025-01-01um14_39_53.thumb.jpg.2a560e91fa4ced680a255912f3d2584f.jpg

Bildschirmfoto2025-01-01um14_39_12.thumb.jpg.c5435beaf1551408931f943e092631fe.jpg

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Posted
5 minutes ago, thomaso said:

Here's an example of @lepr:

Thanks, not the one I was thinking of - which allowed you to target a range of numbers

Hopefully, someone can remember that one for the OP

To save time I am currently using an automated AI to reply to some posts on this forum. If any of "my" posts are wrong or appear to be total b*ll*cks they are the ones generated by the AI. If correct they were probably mine. I apologise for any mistakes made by my AI - I'm sure it will improve with time.

Posted
18 hours ago, Planetdune said:

I notice a lot of white in my image is not 100% white. If I use a color picker, the values are somewhere around the 240 to 248 for the RGB values. Is there a way to select let's say all pixels in an image that are 235+ for all three values (RGB) and then replace those pixels with pure white? (and of course leave all pixels that have at least 1 value below 235 alone)

 

procedural235.png.a0d4ad445e23e23b5ba1495a7a74f179.png

Posted
52 minutes ago, lepr said:

max(R, step(t/255, min(R, G, B)))

Nice. – Can PT also be used to affect 'grays' only (if R, G, B have ca. same values)? – Or/and with a soft edge?

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Posted
2 hours ago, thomaso said:

Nice. – Can PT also be used to affect 'grays' only (if R, G, B have ca. same values)? – Or/and with a soft edge?

Possible yes. But the formulas get quite complex soon.

to identify grey values:

var isg=1-sign(max(R,G,B)-min(R,G,B));

1 if grey, 0 if  not grey

Now combine this var with lerp (a,b,c) to deliver either unchanged RGB or changed Grey values.

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted
18 hours ago, NotMyFault said:

var isg=1-sign(max(R,G,B)-min(R,G,B))

Thanks! Actually, with "ca. same values" I didn't mean to identify pure neutral grays but a range of grays with subtle tints of colours, a kind of +/- deviation from identical values. Never mind, it exceeds this thread and the OP's request.

And, yes, I see the complexity and I still need to understand that PT is "just maths" rather than a script language for more complex conditions, not to mention limitations in the interface of Affinity's PT dialog window and the limited Affinity help which doesn't list "isg" for instance and mentions "sign" but without a note about its usage. An online search leads me to lists or tables of "maths symbols" as kind of single 'characters', without "isg" or "sign" or the large range of 'words' listed in the Affinity help. So it appears I lack the general skills to understand how to handle PT inputs.

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Posted

Isg (is grey)is just a Self Chosen name for the variable, not a predefined function.

for estimate values, we can use the step function to allow certain variance of values.

When I’m retired and have more time I will write a cross compiler which translates regular if / then / else / and / or / less / equal functions into PT syntax.

Any macro language can do that.

But I hope Affinity will release a general scripting earlier.

 

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted

Here a formula to select grey pixels with a selectable tolerance (roughly saturation):

RGB vec3(R,G,B)

A var isg=1-sign(max(R,G,B)-min(R,G,B)-a); isg

input variable a (tolerance) of type 0,1

0: only pure grey

1: includes fully saturated colors

 

Screenshot 2025-01-02 at 23.26.05.png

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted
4 hours ago, NotMyFault said:

Here a formula to select grey pixels with a selectable tolerance (roughly saturation):

RGB vec3(R,G,B)

A var isg=1-sign(max(R,G,B)-min(R,G,B)-a); isg

Thank you for the PT equations. 

Question...what does "vec3(R,G,B) do and why is it needed? I didn't notice any difference whether that was included or removed. I'm just trying to learn a bit more about PT filters and equations. Thanks.

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted

It is creating a vector from the RGB color channels. You may modify this to make any desired adjustments to the color values. Is redundant at this stage, just the „anchor“ for future modifications 

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted
4 hours ago, NotMyFault said:

It is creating a vector from the RGB color channels. You may modify this to make any desired adjustments to the color values. Is redundant at this stage, just the „anchor“ for future modifications 

Thanks for that. I have no idea how to use the vector function, but will have a look. If you have any examples (and time), I'd love to learn more about using vectors, how they work, etc. 👍

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
On 1/1/2025 at 6:56 PM, NotMyFault said:

Possible yes. But the formulas get quite complex soon.

to identify grey values:

var isg=1-sign(max(R,G,B)-min(R,G,B));

1 if grey, 0 if  not grey

Now combine this var with lerp (a,b,c) to deliver either unchanged RGB or changed Grey values.

f***in’ great to see people handle more traditional middleschool math.

Thanks!

Question, is it possible to share a ready Preset file on your amazing equations?

 

Happy guy playing around with the Affinity Suite - really love typographic, photographing, Color & forms, AND, old Synthesizers from the 1980-1990’s…

Macbook Pro 16” M1 2021 connected to an 32” curved 5K external display, iPad Pro 12.9” M1 2021, iPad Pro 10.5” A10X 2017, iMac 27” 5K/i7 late 2015 - also an Lenovo iMac i7 clone with 24” touch screen and Windows 10…

Posted
Just now, AffinityMakesMeWonder said:

f***in’ great to see people handle more than traditional middleschool math.

Thanks!

Question, is it possible to share a ready Preset file on your amazing equations?

 

 

Happy guy playing around with the Affinity Suite - really love typographic, photographing, Color & forms, AND, old Synthesizers from the 1980-1990’s…

Macbook Pro 16” M1 2021 connected to an 32” curved 5K external display, iPad Pro 12.9” M1 2021, iPad Pro 10.5” A10X 2017, iMac 27” 5K/i7 late 2015 - also an Lenovo iMac i7 clone with 24” touch screen and Windows 10…

Posted
22 minutes ago, AffinityMakesMeWonder said:

Question, is it possible to share a ready Preset file on your amazing equations?

Yes, I can export either a file with that PT filter, or export the settings. 
 

Unfortunately it is a bit time consuming, and I often use Beta Releases so older Releases won’t open the files. 
 

And I mostly use iPad which doesn’t allow to edit formulas, so I fall back providing the formula as text for a quick reply. 

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Posted
13 minutes ago, NotMyFault said:

Yes, I can export either a file with that PT filter, or export the settings. 

Unfortunately it is a bit time consuming, and I often use Beta Releases so older Releases won’t open the files. 

And I mostly use iPad which doesn’t allow to edit formulas, so I fall back providing the formula as text for a quick reply. 

Whatever is easiest for you is fine by me. I have the beta, and can download the latest beta version if that's what you send. At your leisure. Thanks.

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
8 hours ago, NotMyFault said:

Yes, I can export either a file with that PT filter, or export the settings. 
 

Unfortunately it is a bit time consuming, and I often use Beta Releases so older Releases won’t open the files. 
 

And I mostly use iPad which doesn’t allow to edit formulas, so I fall back providing the formula as text for a quick reply. 

Thanks for a quick answer.

Maybe I have to look harder on that screenshots and figure out a working equation.

Goodnight from Sweden!

 

Happy guy playing around with the Affinity Suite - really love typographic, photographing, Color & forms, AND, old Synthesizers from the 1980-1990’s…

Macbook Pro 16” M1 2021 connected to an 32” curved 5K external display, iPad Pro 12.9” M1 2021, iPad Pro 10.5” A10X 2017, iMac 27” 5K/i7 late 2015 - also an Lenovo iMac i7 clone with 24” touch screen and Windows 10…

Posted
44 minutes ago, AffinityMakesMeWonder said:

Maybe I have to look harder on that screenshots and figure out a working equation.

The screenshots plus the accompanying text should tell you all you need for that. Just keep in mind that the "RGB" & the "A" in the text represent which buttons should be enabled in the equations -- so "A" means just the alpha button while "RGB" means all 3 of those buttons.

All 3 1.10.8, & all 3 V2.6 Mac apps; 2020 iMac 27"; 3.8GHz i7, Radeon Pro 5700, 32GB RAM; macOS 10.15.7
A
ll 3 V2 apps for iPad; 6th Generation iPad 32 GB; Apple Pencil; iPadOS 15.7

Posted
15 hours ago, NotMyFault said:

Koch ich doch selbst 

Das dachte ich mir schon, just because of this special autocarrot … ich hatte nur noch nicht das Amuse-Gueule aus deiner Küche.

10 hours ago, Ldina said:

I'd love to learn more about using vectors, how they work, etc. 👍

Me too. I suspect that the term “vector” corresponds to the colour channels R, G, B, similar to the “vectors” of HSL.

HSL_color_cylinderKopie.jpg.b342f28bf623779f30fe7834d20cf50e.jpg

10 hours ago, AffinityMakesMeWonder said:

is it possible to share a ready Preset file on your amazing equations?

Attached a file with both @lepr's + @notmyfault's PT recipes combined. You can play with the two sliders in the lower part of the panel to affect the grayish background in different ways (compare the OP's initial request).

The possibilities with PT are very interesting, but honestly I would only use the recipes here for a rough result, unless there were further refinement options, such as a soft edge. The antialiased edges of the 3 fully saturated colour fields probably also need special treatment so that they do not compete with the halftones in the photo.

PT grays > white & exclude colour.afphoto

macOS 10.14.6 | MacBookPro Retina 15" | Eizo 27" | Affinity V1

Posted
6 hours ago, thomaso said:

Das dachte ich mir schon, just because of this special autocarrot … ich hatte nur noch nicht das Amuse-Gueule aus deiner Küche.

Me too. I suspect that the term “vector” corresponds to the colour channels R, G, B, similar to the “vectors” of HSL.

HSL_color_cylinderKopie.jpg.b342f28bf623779f30fe7834d20cf50e.jpg

Attached a file with both @lepr's + @notmyfault's PT recipes combined. You can play with the two sliders in the lower part of the panel to affect the grayish background in different ways (compare the OP's initial request).

The possibilities with PT are very interesting, but honestly I would only use the recipes here for a rough result, unless there were further refinement options, such as a soft edge. The antialiased edges of the 3 fully saturated colour fields probably also need special treatment so that they do not compete with the halftones in the photo.

PT grays > white & exclude colour.afphoto

Thanks for that file!

I’m sitting here with my morning coffee and my iPad, but I will test this later on my Macbook Pro.

Me too have discovered this area interesting concerning equations and PT (after many many years in the Affinity community)…

Happy guy playing around with the Affinity Suite - really love typographic, photographing, Color & forms, AND, old Synthesizers from the 1980-1990’s…

Macbook Pro 16” M1 2021 connected to an 32” curved 5K external display, iPad Pro 12.9” M1 2021, iPad Pro 10.5” A10X 2017, iMac 27” 5K/i7 late 2015 - also an Lenovo iMac i7 clone with 24” touch screen and Windows 10…

Posted
12 hours ago, thomaso said:

Me too. I suspect that the term “vector” corresponds to the colour channels R, G, B, similar to the “vectors” of HSL.

Thomaso, thank you for this comment. I hadn't considered that "vectors" in this context referred to HSL or HSV color models, but it made a lot of sense. That was one very big, missing key to my understanding!

I created a PT filter to test this, and for vec3(R, G, B), I entered vec3 (0.5, 0.8, 0.1), and checked all of the RGB channel boxes so they were active. It gave me a solid yellow-green color. This matches the color I get if I enter the following numbers in the RGB channels...127 Red (0.5 X 255), 204 Green (0.8 X 255), and 25 Blue (0.1 X 255). So, it looks like that vec3 function is converting those RGB values (in 0 to 1 terms) to HSL values. The Info Panel shows that these RGB numbers result in 86H/78S/45L (which is the resulting output of that vector function and numbers). 

I'm still not sure exactly what to do with it, but at least I know what vec3 does now!! Thanks.

vec3.jpg

2024 MacBook Pro M4 Max, 48GB, 1TB SSD, Sequoia OS, Affinity Photo/Designer/Publisher v1 & v2, Adobe CS6 Extended, LightRoom v6, Blender, InkScape, Dell 30" Monitor, Canon PRO-100 Printer, i1 Spectrophotometer, i1Publish, Wacom Intuos 4 PTK-640 graphics tablet

Posted
42 minutes ago, Ldina said:

So, it looks like that vec3 function is converting those RGB values (in 0 to 1 terms) to HSL values

This is not correct.

vec3 simply stores the 3 parameters in a different format, and does not convert in any way.

a vector is just an array of values, 3 in the case of vec3, and allows to apply functions on all its values in one step. You can then extract its values again, by adding .x (or .y or .z) to the vector.

Vectors simply allow to write the formulas more compact. 
 

And vectors are a mathematical term to represent 2 or 3 (or any number of) dimensional values, used commonly in graphic apps to represent 2D or 3D coordinates or color values in any color format (RGB, HSL, CMYK, …).

The numbers from 0 to 255 in the color panel can be shown in different units, either 0-255 or 0-1 (by dividing by 255) or hexadecimal 00 to FF. This is a feature of color panel, not of vec3.

 

 

 

more compact way

Mac mini M1 A2348 | MBP M3 

Windows 11 - AMD Ryzen 9 5900x - 32 GB RAM - Nvidia GTX 1080

LG34WK950U-W, calibrated to DCI-P3 with LG Calibration Studio / Spider 5 | Dell 27“ 4K

iPad Air Gen 5 (2022) A2589

Special interest into procedural texture filter, edit alpha channel, RGB/16 and RGB/32 color formats, stacking, finding root causes for misbehaving files, finding creative solutions for unsolvable tasks, finding bugs in Apps.

I use iPad screenshots and videos even in the Desktop section of the forum when I expect no relevant difference.

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...

Important Information

Terms of Use | Privacy Policy | Guidelines | We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.