How to use the pyscreeze.locateAll function in PyScreeze

To help you get started, we’ve selected a few PyScreeze examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github asweigart / pyscreeze / tests / test_pyscreeze.py View on Github external
def test_locateAll_filename(self):
        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll('slash.png', 'haystack1.png')))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll('slash.png', 'haystack2.png')))

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll('slash.png', 'haystack1.png', grayscale=True)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll('slash.png', 'haystack2.png', grayscale=True)))

        self.assertEqual((), tuple(pyscreeze.locateAll('slash.png', 'colornoise.png')))
        self.assertEqual((), tuple(pyscreeze.locateAll('slash.png', 'colornoise.png', grayscale=True)))
github asweigart / pyscreeze / tests / benchmarks.py View on Github external
imageWidth, imageHeight = largeNoiseIm.size
    needle10x10   = largeNoiseIm.crop((imageWidth - 10,  imageHeight - 10,  imageWidth, imageHeight))
    needle100x100 = largeNoiseIm.crop((imageWidth - 100, imageHeight - 100, imageWidth, imageHeight))
    needle500x500 = largeNoiseIm.crop((imageWidth - 500, imageHeight - 500, imageWidth, imageHeight))

    profiler = cProfile.Profile()
    profiler.enable()
    list(pyscreeze.locateAll(needle10x10, largeNoiseIm))
    profiler.disable()
    print('10x10 needle:')
    pstats.Stats(profiler).sort_stats('cumulative').print_stats(1)

    profiler = cProfile.Profile()
    profiler.enable()
    list(pyscreeze.locateAll(needle100x100, largeNoiseIm))
    profiler.disable()
    print('100x100 needle:')
    pstats.Stats(profiler).sort_stats('cumulative').print_stats(1)

    profiler = cProfile.Profile()
    profiler.enable()
    list(pyscreeze.locateAll(needle500x500, largeNoiseIm))
    profiler.disable()
    print('500x500 needle:')
    pstats.Stats(profiler).sort_stats('cumulative').print_stats(1)
github asweigart / pyscreeze / tests / test_pyscreeze.py View on Github external
def test_locateAll_filename(self):
        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll('slash.png', 'haystack1.png')))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll('slash.png', 'haystack2.png')))

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll('slash.png', 'haystack1.png', grayscale=True)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll('slash.png', 'haystack2.png', grayscale=True)))

        self.assertEqual((), tuple(pyscreeze.locateAll('slash.png', 'colornoise.png')))
        self.assertEqual((), tuple(pyscreeze.locateAll('slash.png', 'colornoise.png', grayscale=True)))
github asweigart / pyscreeze / tests / test_pyscreeze.py View on Github external
slashFp = open('slash.png' ,'rb')
        haystack1Fp = open('haystack1.png' ,'rb')
        haystack2Fp = open('haystack2.png' ,'rb')
        colorNoiseFp = open('colornoise.png' ,'rb')
        slashIm = Image.open(slashFp)
        haystack1Im = Image.open(haystack1Fp)
        haystack2Im = Image.open(haystack2Fp)
        colorNoiseIm = Image.open(colorNoiseFp)

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll(slashIm, haystack1Im)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll(slashIm, haystack2Im)))

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll(slashIm, haystack1Im, grayscale=True)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll(slashIm, haystack2Im, grayscale=True)))

        self.assertEqual((), tuple(pyscreeze.locateAll(slashIm, colorNoiseIm)))
        self.assertEqual((), tuple(pyscreeze.locateAll(slashIm, colorNoiseIm, grayscale=True)))

        slashFp.close()
        haystack1Fp.close()
        haystack2Fp.close()
        colorNoiseFp.close()
github asweigart / pyscreeze / tests / test_pyscreeze.py View on Github external
def test_locateAll_filename(self):
        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll('slash.png', 'haystack1.png')))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll('slash.png', 'haystack2.png')))

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll('slash.png', 'haystack1.png', grayscale=True)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll('slash.png', 'haystack2.png', grayscale=True)))

        self.assertEqual((), tuple(pyscreeze.locateAll('slash.png', 'colornoise.png')))
        self.assertEqual((), tuple(pyscreeze.locateAll('slash.png', 'colornoise.png', grayscale=True)))
github asweigart / pyscreeze / tests / test_pyscreeze.py View on Github external
haystack1Fp = open('haystack1.png' ,'rb')
        haystack2Fp = open('haystack2.png' ,'rb')
        colorNoiseFp = open('colornoise.png' ,'rb')
        slashIm = Image.open(slashFp)
        haystack1Im = Image.open(haystack1Fp)
        haystack2Im = Image.open(haystack2Fp)
        colorNoiseIm = Image.open(colorNoiseFp)

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll(slashIm, haystack1Im)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll(slashIm, haystack2Im)))

        self.assertEqual(((94, 94, 4, 4),), tuple(pyscreeze.locateAll(slashIm, haystack1Im, grayscale=True)))
        self.assertEqual(((93, 93, 4, 4), (94, 94, 4, 4), (95, 95, 4, 4)), tuple(pyscreeze.locateAll(slashIm, haystack2Im, grayscale=True)))

        self.assertEqual((), tuple(pyscreeze.locateAll(slashIm, colorNoiseIm)))
        self.assertEqual((), tuple(pyscreeze.locateAll(slashIm, colorNoiseIm, grayscale=True)))

        slashFp.close()
        haystack1Fp.close()
        haystack2Fp.close()
        colorNoiseFp.close()
github AXeL-dev / Dindo-Bot / pyautogui / __init__.py View on Github external
def locateAll(*args, **kwargs):
        return pyscreeze.locateAll(*args, **kwargs)
github asweigart / pyautogui / pyautogui / __init__.py View on Github external
def _locateAll(*args, **kwargs):
    return pyscreeze.locateAll(*args, **kwargs)