none
How do I find a picture/image on the screen and get the x,y coordinates? - C#.NET RRS feed

  • Question

  • Hi Guys,

    I want to find the picture/image on the screen and get the x,y coordinates if it matched on the screen. I already know how to move the mouse and click using this x,y coordinates.

    Example: I have cropped "This PC" image on the windows desktop screen and saved it as "This PC.png". I want to find the x,y coordinates of that picture(This PC.png) that would exactly match on the desktop screen. So my C# code needs to find that "This PC.png" image on the desktop screen and return the x,y mouse coordinates.

    I want to click/double-click the "This PC" option using this x,y mouse coordinates and open it.

    Thanks

    Satheesh


    Wednesday, December 4, 2019 4:58 AM

All replies

  • You CERTAINLY do not want to look for this as an image.  You can enumerate the child windows of the desktop to find the icons, but there are much better ways to do this.  If all you want to do is open the Explorer window for your PC, then just use something like Process.Start(@"c:\");

    Tim Roberts | Driver MVP Emeritus | Providenza & Boekelheide, Inc.

    Wednesday, December 4, 2019 7:43 AM
  • If you want to get Desktop icons positions, use IFolderView.GetItemPosition

    Wednesday, December 4, 2019 7:57 AM
  • Thank Tim & Castorix.

    The child window enumerations and IFolderView.GetItemPosition are not fit for my automation process. I want to get the X,Y coordinates of given image if its available on the current screen(not only desktop screen). The screen might be a RDP window or published app/desktops(virtualization) views. Based on X,Y coordinates, i want to do mouse click or type events, etc...

    Just for demo(example) purpose i had used that image above.

    Thanks,

    Satheesh






    Wednesday, December 4, 2019 8:00 AM

  • There are two methods to find an image in this thread. It is vb.net code you will need to convert it. Most of the code is to capture the desktop which you already have? So you just need the part that searches one image for another.

    https://social.msdn.microsoft.com/Forums/vstudio/en-US/511fd438-0c1b-4239-80b0-821c91757bb1/move-mouse-cursor-to-specific-icon-based-on-saved-image?forum=vbgeneral

    We can help convert it etc if you want to use it.

    Wednesday, December 4, 2019 2:21 PM
  • Thanks Tommy. This is what I'm looking for.

    I have converted that VB.net code into C# code here; But sometime failed to find the image on the screen. Always return the incorrect x,y coordinates(rect.Location.X and rect.Location.X) if find the image on the screen, so cursor moved to different location. I have converted that image pixel from 32bpp to 24bpp.

    Please help me to fix it.

    public static void Main(string[] args)
        {
            Bitmap ImgToFind = new Bitmap(@"C:\Users\xxxx\bin\Release\image2.png");
            Bitmap ImgToFind1 = new Bitmap(ImgToFind.Width, ImgToFind.Height, PixelFormat.Format24bppRgb);

            Rectangle rect = FindImageOnScreen(ImgToFind1, true);
            if (rect != Rectangle.Empty)
            {
                Console.WriteLine(rect.Location.X + " " + rect.Location.Y);
                Point cntr = new Point(rect.X + System.Convert.ToInt32(rect.Width / (double)2), rect.Y + System.Convert.ToInt32(rect.Height / (double)2));
                //Point cntr = new Point(rect.X , rect.Y);
                Cursor.Position = cntr;
            }
            else
                MessageBox.Show("Image not found");
        }

    private static Rectangle FindImageOnScreen(Bitmap bmpMatch, bool ExactMatch)
        {
            Bitmap ScreenBmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format24bppRgb);
            using (Graphics g = Graphics.FromImage(ScreenBmp))
            {
                g.CopyFromScreen(Screen.PrimaryScreen.Bounds.Location, Point.Empty, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
            }

            BitmapData ImgBmd = bmpMatch.LockBits(new Rectangle(0, 0, bmpMatch.Width, bmpMatch.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            BitmapData ScreenBmd = ScreenBmp.LockBits(Screen.PrimaryScreen.Bounds, ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);

            byte[] ImgByts = new byte[(Math.Abs(ImgBmd.Stride) * bmpMatch.Height) - 1 + 1];
            byte[] ScreenByts = new byte[(Math.Abs(ScreenBmd.Stride) * ScreenBmp.Height) - 1 + 1];

            Marshal.Copy(ImgBmd.Scan0, ImgByts, 0, ImgByts.Length);
            Marshal.Copy(ScreenBmd.Scan0, ScreenByts, 0, ScreenByts.Length);

            bool FoundMatch = false;
            Rectangle rct = Rectangle.Empty;
            int sindx, iindx;
            int spc, ipc;

            int skpx = System.Convert.ToInt32((bmpMatch.Width - 1) / (double)10);
            if (skpx < 1 | ExactMatch)
                skpx = 1;
            int skpy = System.Convert.ToInt32((bmpMatch.Height - 1) / (double)10);
            if (skpy < 1 | ExactMatch)
                skpy = 1;

            for (int si = 0; si <= ScreenByts.Length - 1; si += 3)
            {
                FoundMatch = true;
                for (int iy = 0; iy <= ImgBmd.Height - 1; iy += skpy)
                {
                    for (int ix = 0; ix <= ImgBmd.Width - 1; ix += skpx)
                    {
                        sindx = (iy * ScreenBmd.Stride) + (ix * 3) + si;
                        iindx = (iy * ImgBmd.Stride) + (ix * 3);
                        spc = Color.FromArgb(ScreenByts[sindx + 2], ScreenByts[sindx + 1], ScreenByts[sindx]).ToArgb();
                        ipc = Color.FromArgb(ImgByts[iindx + 2], ImgByts[iindx + 1], ImgByts[iindx]).ToArgb();
                        if (spc != ipc)
                        {
                            FoundMatch = false;
                            iy = ImgBmd.Height - 1;
                            ix = ImgBmd.Width - 1;
                        }
                    }
                }
                if (FoundMatch)
                {
                    double r = si / (double)(ScreenBmp.Width * 3);
                    double c = ScreenBmp.Width * (r % 1);
                    if (r % 1 >= 0.5)
                        r -= 1;
                    rct.X = System.Convert.ToInt32(c);
                    rct.Y = System.Convert.ToInt32(r);
                    rct.Width = bmpMatch.Width;
                    rct.Height = bmpMatch.Height;
                    break;
                }
            }
            bmpMatch.UnlockBits(ImgBmd);
            ScreenBmp.UnlockBits(ScreenBmd);
            ScreenBmp.Dispose();
            return rct;
        }

    Thursday, December 5, 2019 4:44 AM
  • Sat,

    I am not sure what you mean exactly.

    Edit: To keep it simple here is a new simplified example using your images and it just gives the found image rectangle result. That way we all use the same thing and no mouse etc.

    Here is the result of the new example and the images I used.

    .

    .

    .

    using System;
    using System.Drawing;
    using System.Drawing.Imaging;
    using System.Runtime.InteropServices;
    using System.Windows.Forms;
    
    namespace Test_C
    {
        public partial class Form2 : Form
        {
    
            private Bitmap ImgToFind = new Bitmap(@"C:\bitmaps\find image.png");
            private Bitmap ScreenBmp = new Bitmap(@"c:\bitmaps\find image screen.png");
    
            public Form2()
            {
                InitializeComponent();
            }
    
            private void Form2_Load(object sender, EventArgs e)
            {
    
                Rectangle rect = FindImageOnScreen(ImgToFind, false);
    
                if (rect != Rectangle.Empty)//Image Foud
                {
                    //Point cntr = new Point(rect.X + System.Convert.ToInt32(rect.Width / (double)2), rect.Y + System.Convert.ToInt32(rect.Height / (double)2));
                    //Cursor.Position = cntr;
    
                    MessageBox.Show(rect.ToString());
    
                }
                else
                    MessageBox.Show("Image not found");
    
            }
    
            /// <summary>Finds a matching image on the screen.</summary>
    
            ///     ''' <param name="bmpMatch">The image to find on the screen.</param>
    
            ///     ''' <param name="ExactMatch">True finds an exact match (slowerer on large images). False finds a close match (faster on large images).</param>
    
            ///     ''' <returns>Returns a Rectangle of the found image in sceen coordinates.</returns>
            private Rectangle FindImageOnScreen(Bitmap bmpMatch, bool ExactMatch)
            {
    
                BitmapData ImgBmd = bmpMatch.LockBits(new Rectangle(0, 0, bmpMatch.Width, bmpMatch.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
                BitmapData ScreenBmd = ScreenBmp.LockBits(new Rectangle(0, 0, ScreenBmp.Width, ScreenBmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
    
                byte[] ImgByts = new byte[(Math.Abs(ImgBmd.Stride) * bmpMatch.Height) - 1 + 1];
                byte[] ScreenByts = new byte[(Math.Abs(ScreenBmd.Stride) * ScreenBmp.Height) - 1 + 1];
    
                Marshal.Copy(ImgBmd.Scan0, ImgByts, 0, ImgByts.Length);
                Marshal.Copy(ScreenBmd.Scan0, ScreenByts, 0, ScreenByts.Length);
    
                bool FoundMatch = false;
                Rectangle rct = Rectangle.Empty;
                int sindx, iindx;
                int spc, ipc;
    
                int skpx = System.Convert.ToInt32((bmpMatch.Width - 1) / (double)10);
                if (skpx < 1 | ExactMatch)
                    skpx = 1;
                int skpy = System.Convert.ToInt32((bmpMatch.Height - 1) / (double)10);
                if (skpy < 1 | ExactMatch)
                    skpy = 1;
    
                for (int si = 0; si <= ScreenByts.Length - 1; si += 3)
                {
                    FoundMatch = true;
                    for (int iy = 0; iy <= ImgBmd.Height - 1; iy += skpy)
                    {
                        for (int ix = 0; ix <= ImgBmd.Width - 1; ix += skpx)
                        {
                            sindx = (iy * ScreenBmd.Stride) + (ix * 3) + si;
                            iindx = (iy * ImgBmd.Stride) + (ix * 3);
                            spc = Color.FromArgb(ScreenByts[sindx + 2], ScreenByts[sindx + 1], ScreenByts[sindx]).ToArgb();
                            ipc = Color.FromArgb(ImgByts[iindx + 2], ImgByts[iindx + 1], ImgByts[iindx]).ToArgb();
                            if (spc != ipc)
                            {
                                FoundMatch = false;
                                iy = ImgBmd.Height - 1;
                                ix = ImgBmd.Width - 1;
                            }
                        }
                    }
                    if (FoundMatch)
                    {
                        double r = si / (double)(ScreenBmp.Width * 3);
                        double c = ScreenBmp.Width * (r % 1);
                        if (r % 1 >= 0.5)
                            r -= 1;
                        rct.X = System.Convert.ToInt32(c);
                        rct.Y = System.Convert.ToInt32(r);
                        rct.Width = bmpMatch.Width;
                        rct.Height = bmpMatch.Height;
                        break;
                    }
                }
    
                bmpMatch.UnlockBits(ImgBmd);
                ScreenBmp.UnlockBits(ScreenBmd);
                //ScreenBmp.Dispose();
                return rct;
            }
    
    
        }
    }







    • Edited by tommytwotrain Thursday, December 5, 2019 5:20 PM update example
    Thursday, December 5, 2019 9:59 AM
  • Many Thanks Tom,

    I have tried the below C# code to find the image(ImgToFind1) on the screen(ScreenBmp).

    public static void Main(string[] args)
        {
            string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\ThisPC.png";//Load from disk
            Bitmap ImgToFind = new Bitmap(path);
            Bitmap ImgToFind1 = new Bitmap(ImgToFind.Width, ImgToFind.Height, PixelFormat.Format24bppRgb);//Convert to 24bppRgb
            using (Graphics gr = Graphics.FromImage(ImgToFind1))
            {
                gr.DrawImage(ImgToFind, new Rectangle(0, 0, ImgToFind1.Width, ImgToFind1.Height));
            }

            //Capture the current/desktop screen and stored as Bitmap image
            Bitmap ScreenBmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format24bppRgb);
            using (Graphics g = Graphics.FromImage(ScreenBmp))
            {
                g.CopyFromScreen(Screen.PrimaryScreen.Bounds.Location, Point.Empty, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
            }

            Rectangle rect = FindImageOnScreen(ImgToFind1, ScreenBmp, true);//Find image
            if (rect != Rectangle.Empty)//Image Foud
            {
                Point cntr = new Point(rect.X + System.Convert.ToInt32(rect.Width / (double)2), rect.Y + System.Convert.ToInt32(rect.Height / (double)2));
                Cursor.Position = cntr;

    LeftMouseClick(int xpos, int ypos);//Do left mouse click.

            }
            else
                MessageBox.Show("Image not found");
        }

    private static Rectangle FindImageOnScreen(Bitmap bmpMatch, Bitmap ScreenBmp, bool ExactMatch)
        {
            BitmapData ImgBmd = bmpMatch.LockBits(new Rectangle(0, 0, bmpMatch.Width, bmpMatch.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            BitmapData ScreenBmd = ScreenBmp.LockBits(new Rectangle(0, 0, ScreenBmp.Width, ScreenBmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);

            byte[] ImgByts = new byte[(Math.Abs(ImgBmd.Stride) * bmpMatch.Height) - 1 + 1];
            byte[] ScreenByts = new byte[(Math.Abs(ScreenBmd.Stride) * ScreenBmp.Height) - 1 + 1];

            Marshal.Copy(ImgBmd.Scan0, ImgByts, 0, ImgByts.Length);
            Marshal.Copy(ScreenBmd.Scan0, ScreenByts, 0, ScreenByts.Length);

            bool FoundMatch = false;
            Rectangle rct = Rectangle.Empty;
            int sindx, iindx;
            int spc, ipc;

            int skpx = System.Convert.ToInt32((bmpMatch.Width - 1) / (double)10);
            if (skpx < 1 | ExactMatch)
                skpx = 1;
            int skpy = System.Convert.ToInt32((bmpMatch.Height - 1) / (double)10);
            if (skpy < 1 | ExactMatch)
                skpy = 1;

            for (int si = 0; si <= ScreenByts.Length - 1; si += 3)
            {
                FoundMatch = true;
                for (int iy = 0; iy <= ImgBmd.Height - 1; iy += skpy)
                {
                    for (int ix = 0; ix <= ImgBmd.Width - 1; ix += skpx)
                    {
                        sindx = (iy * ScreenBmd.Stride) + (ix * 3) + si;
                        iindx = (iy * ImgBmd.Stride) + (ix * 3);
                        spc = Color.FromArgb(ScreenByts[sindx + 2], ScreenByts[sindx + 1], ScreenByts[sindx]).ToArgb();
                        ipc = Color.FromArgb(ImgByts[iindx + 2], ImgByts[iindx + 1], ImgByts[iindx]).ToArgb();
                        if (spc != ipc)
                        {
                            FoundMatch = false;
                            iy = ImgBmd.Height - 1;
                            ix = ImgBmd.Width - 1;
                        }
                    }
                }
                if (FoundMatch)
                {
                    double r = si / (double)(ScreenBmp.Width * 3);
                    double c = ScreenBmp.Width * (r % 1);
                    if (r % 1 >= 0.5)
                        r -= 1;
                    rct.X = System.Convert.ToInt32(c);
                    rct.Y = System.Convert.ToInt32(r);
                    rct.Width = bmpMatch.Width;
                    rct.Height = bmpMatch.Height;
                    break;
                }
            }

            bmpMatch.UnlockBits(ImgBmd);
            ScreenBmp.UnlockBits(ScreenBmd);
            ScreenBmp.Dispose();
            return rct;
        }

    public static void LeftMouseClick(int xpos, int ypos)
            {
                SetCursorPos(xpos, ypos);
                Thread.Sleep(200);
                mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
                mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);
            }

    I have tried all images(marked in yellow) on the screen, but it showing the "Image not found" msg box.


    Here i want to find the any of the image(ThisPC.img,EditPlus.png,WindowsStart.png) from my desktop screen and click on it using the X,Y coordination. This images might vary based on user requirement. So I want automate the actions(clicks) based end user inputs as images.


    Thursday, December 5, 2019 11:38 AM
  • Many Thanks Tom,

    I have tried the below C# code to find the image(ImgToFind1) on the screen(ScreenBmp).

    public static void Main(string[] args)
        {
            string path = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location) + @"\ThisPC.png";//Load from disk
            Bitmap ImgToFind = new Bitmap(path);
            Bitmap ImgToFind1 = new Bitmap(ImgToFind.Width, ImgToFind.Height, PixelFormat.Format24bppRgb);//Convert to 24bppRgb
            using (Graphics gr = Graphics.FromImage(ImgToFind1))
            {
                gr.DrawImage(ImgToFind, new Rectangle(0, 0, ImgToFind1.Width, ImgToFind1.Height));
            }

            //Capture the current/desktop screen and stored as Bitmap image
            Bitmap ScreenBmp = new Bitmap(Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, PixelFormat.Format24bppRgb);
            using (Graphics g = Graphics.FromImage(ScreenBmp))
            {
                g.CopyFromScreen(Screen.PrimaryScreen.Bounds.Location, Point.Empty, Screen.PrimaryScreen.Bounds.Size, CopyPixelOperation.SourceCopy);
            }

            Rectangle rect = FindImageOnScreen(ImgToFind1, ScreenBmp, true);//Find image
            if (rect != Rectangle.Empty)//Image Foud
            {
                Point cntr = new Point(rect.X + System.Convert.ToInt32(rect.Width / (double)2), rect.Y + System.Convert.ToInt32(rect.Height / (double)2));
                Cursor.Position = cntr;

    LeftMouseClick(int xpos, int ypos);//Do left mouse click.

            }
            else
                MessageBox.Show("Image not found");
        }

    private static Rectangle FindImageOnScreen(Bitmap bmpMatch, Bitmap ScreenBmp, bool ExactMatch)
        {
            BitmapData ImgBmd = bmpMatch.LockBits(new Rectangle(0, 0, bmpMatch.Width, bmpMatch.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);
            BitmapData ScreenBmd = ScreenBmp.LockBits(new Rectangle(0, 0, ScreenBmp.Width, ScreenBmp.Height), ImageLockMode.ReadOnly, PixelFormat.Format24bppRgb);

            byte[] ImgByts = new byte[(Math.Abs(ImgBmd.Stride) * bmpMatch.Height) - 1 + 1];
            byte[] ScreenByts = new byte[(Math.Abs(ScreenBmd.Stride) * ScreenBmp.Height) - 1 + 1];

            Marshal.Copy(ImgBmd.Scan0, ImgByts, 0, ImgByts.Length);
            Marshal.Copy(ScreenBmd.Scan0, ScreenByts, 0, ScreenByts.Length);

            bool FoundMatch = false;
            Rectangle rct = Rectangle.Empty;
            int sindx, iindx;
            int spc, ipc;

            int skpx = System.Convert.ToInt32((bmpMatch.Width - 1) / (double)10);
            if (skpx < 1 | ExactMatch)
                skpx = 1;
            int skpy = System.Convert.ToInt32((bmpMatch.Height - 1) / (double)10);
            if (skpy < 1 | ExactMatch)
                skpy = 1;

            for (int si = 0; si <= ScreenByts.Length - 1; si += 3)
            {
                FoundMatch = true;
                for (int iy = 0; iy <= ImgBmd.Height - 1; iy += skpy)
                {
                    for (int ix = 0; ix <= ImgBmd.Width - 1; ix += skpx)
                    {
                        sindx = (iy * ScreenBmd.Stride) + (ix * 3) + si;
                        iindx = (iy * ImgBmd.Stride) + (ix * 3);
                        spc = Color.FromArgb(ScreenByts[sindx + 2], ScreenByts[sindx + 1], ScreenByts[sindx]).ToArgb();
                        ipc = Color.FromArgb(ImgByts[iindx + 2], ImgByts[iindx + 1], ImgByts[iindx]).ToArgb();
                        if (spc != ipc)
                        {
                            FoundMatch = false;
                            iy = ImgBmd.Height - 1;
                            ix = ImgBmd.Width - 1;
                        }
                    }
                }
                if (FoundMatch)
                {
                    double r = si / (double)(ScreenBmp.Width * 3);
                    double c = ScreenBmp.Width * (r % 1);
                    if (r % 1 >= 0.5)
                        r -= 1;
                    rct.X = System.Convert.ToInt32(c);
                    rct.Y = System.Convert.ToInt32(r);
                    rct.Width = bmpMatch.Width;
                    rct.Height = bmpMatch.Height;
                    break;
                }
            }

            bmpMatch.UnlockBits(ImgBmd);
            ScreenBmp.UnlockBits(ScreenBmd);
            ScreenBmp.Dispose();
            return rct;
        }

    public static void LeftMouseClick(int xpos, int ypos)
            {
                SetCursorPos(xpos, ypos);
                Thread.Sleep(200);
                mouse_event(MOUSEEVENTF_LEFTDOWN, xpos, ypos, 0, 0);
                mouse_event(MOUSEEVENTF_LEFTUP, xpos, ypos, 0, 0);
            }

    I have tried all images(marked in yellow) on the screen, but it showing the "Image not found" msg box.


    Here i want to find the any of the image(ThisPC.img,EditPlus.png,WindowsStart.png) from my desktop screen and click on it using the X,Y coordination. This images might vary based on user requirement. So I want automate the actions(clicks) based end user inputs as images.


    Sat,

    Did you try my example and get it to work?

    I have updated the c# example in my post above it now works the same as the vb. It just needed the ().

    I am not sure how to run you example, still learning...

    Note that what I did from the original in the other thread is replace the screen capture with a file to avoid problems with screen capture to start.

    Are you sure your screen captured screenBmp is valid? Did you save it and look at it with paint?

    I think if you have text scaling set for the system in the control panel then you may get an enlarged screenbmp. Then the icon image is too small??? Or the icon text is not the same between screen and find image.

    Comprende?

    That's the problem with this method how you do it.

    You should save your screenbmp to disc and look at it in paint make sure the image is same size as your find image ThisPC.png.

    As far as the mouse clicking and etc I dont help with that kind of thing nothing personal.

    :)


    Thursday, December 5, 2019 3:38 PM
  • Here i want to find the any of the image(ThisPC.img,EditPlus.png,WindowsStart.png) from my desktop screen and click on it using the X,Y coordination. This images might vary based on user requirement. So I want automate the actions(clicks) based end user inputs as images.


    PS You don't need the screenBmp.dispose in the sub routine when declared at class level. I have removed it from my example.

    If you do a new screen capture in the sub routine then you should dispose the new bmp in the sub.

    Thursday, December 5, 2019 5:25 PM
  • Many Thanks Tom,

    I have tried your code(both VB.net & C#.net) in different OS machines and mentioned the outcomes below;

    Windows 10 - Find images & working as expected.

    Windows Server 2008 R2 & 2012  - Find images, but failed to find the corner images(TopLeft, BottomLeft, TopRight, BottomRight) on the screen.

    For example "Start" menu in "BottomLeft" corner.


    Friday, December 6, 2019 12:56 PM
  • Many Thanks Tom,

    I have tried your code(both VB.net & C#.net) in different OS machines and mentioned the outcomes below;

    Windows 10 - Find images & working as expected.

    Windows Server 2008 R2 & 2012  - Find images, but failed to find the corner images(TopLeft, BottomLeft, TopRight, BottomRight) on the screen.

    For example "Start" menu in "BottomLeft" corner.


    Ok that is good to hear.

    You just need to debug the issues you find now. The basic find image search has been shown to work. Check what it is doing in the corners you may need to single step the loops. Use a file example you can easily look at in paint etc.

    I dont have the OSes you mention.

    Make sure to check the screen captures and the find images. There are issues about screen bounds I think based on the things I mentioned by maybe they cancel out. Also caputure the task bar is a different size and option. Working area etc... I forget exactly.

    The Start image you show has the left cut off? I am not sure what that is. You know you can adjust the monitor image position with monitor software. But it should not affect the capture just what you "see" looking at the monitor and on and on...

    If you get stumped you should start a new question I think so you get everyone looking again. Post a reproducible example with code and the images.

    One issue is finding the image. Another issue is capturing the screen. Two different things.


    Friday, December 6, 2019 3:48 PM
  • Hi SatheeshKumar,

    It seems that your problem has been solved. If so, please click "Mark as answer" to the appropriate answer, so that it will help other members to find the solution quickly if they face a similar issue.

    Best Regards,

    Timon

    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Thursday, December 12, 2019 6:11 AM