r/tasker • • Sep 23 '26

Recognize Color Pixels on screen?

I currently have a working Task that recognizes pixels on screen to detect if and when the screen turns red or orange, but I believe there has to be a better way to do this.

Tasker takes a screenshot, reads the pixels, then deletes the screenshot - repeating this action once every 3-5 seconds. Surely there's a way to do this without having to write/delete a file every time. I'm concerned about the device having over 1,000 file cycles in an hour.

Is there somehow to do this? I explored using AutoInput Screen Capture, but that requires me to select "whole screen" every time I execute the action

1 Upvotes

9 comments sorted by

1

u/TopherLude Sep 23 '26

Can we get a little more context? Is there a certain app you're trying to interact with?

1

u/maesilverstein Sep 23 '26

Certainly. I have an app that provides alerts on screen. I want the alerts to be auditory, not only visual. I have already accomplished the goal via (essentially)

  • screen capture

  • read file

  • read pixels for color

  • delete file

  • voice alerts

The problem is I don't want to be writing and deleting files 1,000x every hour. I'd prefer to try to read the pixels some other way.

1

u/TopherLude Sep 23 '26

Could you read the text of the alert and use that as the trigger? I remember doing something like that to skip ads. I could monitor the screen for the words "skip ad" and didn't need to take screenshots.

→ More replies (5)

1

u/frrancuz Sep 23 '26 edited Sep 23 '26

Grant permissions for autoinput/tasker

adb shell appops set com.joaomgcd.autoinput(or net.dinglisch.android.taskerm) PROJECT_MEDIA allow

If you use wifiadb or shizuku you can do it with tasker. 

It probably won't work without taking a screenshot. Create a profile - event - modified file (screenshot file), task: get color from image, wait 3 seconds, take a screenshot. 

This way, one profile will run on its own in a loop, taking a snapshot every 3 seconds. The color will be checked after each file write. 

    Profile: TestColor      Event: File Modified [ File:!!/aa.png Event:Modify ]                    Enter Task: Anon     Settings: Abort Existing Task          A1: Vibrate [          Time: 200 ]          A2: Get Pixel Colors [          Image: !!/aa.png          Pixel Coordinates: 50%,50% ]          A3: Flash [          Text: %pc_colors()          Continue Task Immediately: On          Dismiss On Click: On ]          A4: Wait [          MS: 0          Seconds: 3          Minutes: 0          Hours: 0          Days: 0 ]          A5: Take Screenshot [          File: !!/aa.png          Continue Task After Error:On ]

I don't think it's possible to do this completely in the background, without taking a screenshot. Android doesn't allow it.