Didge Posted March 6, 2023 Posted March 6, 2023 Hello, I've searched the forums here and couldn't find an answer to this question ... so I hope someone can help me ... I'm doing some experiments relating to image resolution, and I want to turn an RGB image into 4 separate L, R, G and B layers, then recombine them to re-create the original image - basically like an LRGB astrophotography image. I expected the HSL filter with saturation set to zero to give me a layer with the **true** grey values for each pixel, but it doesn't do that - it actually calculates the average of the RGB values, then assigns that as a grey value. So for example, if a pixel is RGB = 55, 67, 82, I want the L value for that pixel to be equal to the base gray level for that pixel :- L = 55 and the corresponding values in the RGB layers to be the difference between the original RGB value and the base gray level :- R = 55 - 55 = 00 G = 67 - 55 = 12 B = 82 - 55 = 27 This way, I can then add the RGB values (00, 12, 27) back to the L value (55) to reconstruct the original RGB value (55, 67, 82). This would give me a luminance layer, and individual R G and B layers which, when added together, are the same as the original image. But AP doesn't work that way. If I set the HSL saturation to zero for the same pixel, the value of L that AP gives me for that pixel is the average of the RGB values :- L = (55 + 67 + 82)/3 = 68 rather than the minimum value (55) - which is what I expected. Can anyone help me create a layer that is a grayscale image, with the value of each pixel equal to the minimum value (not the average) of the RGB values for each pixel in the original RGB image ? Many thanks Quote
David in Яuislip Posted March 6, 2023 Posted March 6, 2023 This procedural texture will take the minimum RGB value and apply to all channels - check a random pixel with the effect off and on This one subtracts the minimum grey values Now do a merge visible using both procedural textures in turn, put the grey one at the top, change its blend mode to add and the original image is rebuilt. Hope that's of help Didge and NotMyFault 2 Quote Microsoft Windows 11 Home, Intel i7-1360P 2.20 GHz, 32 GB RAM, 1TB SSD, Intel Iris Xe Affinity Photo - 24/05/20, Affinity Publisher - 06/12/20, KTM Superduke - 27/09/10
NotMyFault Posted March 6, 2023 Posted March 6, 2023 Affinity uses the Rec.709 coefficients to calculate luma in HSL https://en.wikipedia.org/wiki/Rec._709 When encoding Y’CBCR video, BT.709 creates gamma-encoded luma (Y’) using matrix coefficients 0.2126, 0.7152, and 0.0722 (together they add to 1) Quote 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.
Didge Posted March 6, 2023 Author Posted March 6, 2023 Hi David, Many thanks - that is **exactly** what I needed - thank you so much. Surprisingly simple when one knows what they're doing Cheers, Gary Quote
Recommended Posts
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.