How do I detect the tone of a region of a TImage in Delphi


I am adding overlays to user-submitted images and that means the images might be dark in tone or light in tone. Is there some kind of mechanism by which I can determine whether a particular region of a Timage is tonally light or dark? This will allow me to show the white or black version of my overlay depending. I am using Delphi 10.4 for MacOS so I am working with FMX. The overlay is a small piece of text and an image (in black or white).
This will be overlaying a TImage found in my stylebook definition for a TListboxItem.

Comments are closed.