sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #29447
Re: [Question #258340]: How to use sikuli operations on ScreenShot Image File (UNLIKE Screen Region)
Question #258340 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/258340
Status: Open => Answered
RaiMan proposed the following answer:
Ok, understood:
on your complete webpage image (FullScreenWebpage.png) there are multiple occurrences of the searched image iconToFind.png.
for each occurrence you finally want to save a the visual context of the found occurrence.
--1. findAll()
this is sufficient if you only want to store the matches for later use:
f = Finder("C:\Users\Admin\Desktop\FullScreenWebpage.png")
img = "iconToFind.png"
mm = list(f.findAll(img))
print "Nothing found" if len(mm) == 0 else "found %d" % len(mm)
# an option to sort the matches top down:
mmSorted = sorted(mm, key=lambda m:m.y)
--2. capture from the image complete webpage:
... is not possible with version 1.0.1.
you can only capture screen content, but this does not reflect the image content you are searching in.
So no chance with the 1.0.1 features.
with version 1.0.1 this would be possible:
baseImg = Image.create("C:\Users\Admin\Desktop\FullScreenWebpage.png")
for m in mm:
print m
s = baseImg.getSub(m.x, m.y, 50, 50).asFile()
shutil.move(s,r"<TargetPath>")
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.