sikuli-driver team mailing list archive
-
sikuli-driver team
-
Mailing list archive
-
Message #22414
Re: [Question #239439]: Sikuli - Java Api - find not working using Java BufferedImages --- fixed in version 1.1.0
Question #239439 on Sikuli changed:
https://answers.launchpad.net/sikuli/+question/239439
Status: Open => Answered
RaiMan proposed the following answer:
I do not understand, why you insist on using buffered images, that you
produce by reading image files from the file system.
This is Sikuli's standard approach (reading image files from file
system) to get the images ready for search ops.
Using buffered images would only make sense, if you create them on the
fly in memory.
So your above example with version 1.0.1 would look like this:
package org.sikuli.apptest10;
import java.io.File;
import java.util.Arrays;
import org.sikuli.basics.ImageLocator;
import org.sikuli.script.*;
public class AppTest10 {
private static void log(String msg, Object... args) {
System.out.println(String.format("[user] " + msg, args));
}
public static void main(String[] args) throws FindFailed {
Screen s = new Screen();
String pathImg = new File(System.getProperty("user.dir"), "images").getAbsolutePath();
ImageLocator.addImagePath(pathImg);
log(Arrays.toString(ImageLocator.getImagePath()));
log("" + s.find("some-image.png"));
}
}
With version 1.1 this will be even smoother:
package org.sikuli.apptest11;
import java.io.File;
import org.sikuli.script.*;
public class AppTest11 {
private static void log(String msg, Object... args) {
System.out.println(String.format("[user] " + msg, args));
}
public static void main(String[] args) throws FindFailed {
Screen s = new Screen();
String pathImg = new File(System.getProperty("user.dir"), "images").getAbsolutePath();
ImagePath.setBundlePath(pathImg);
ImagePath.printPaths();
log("" + s.find("nb01"));
}
}
--
You received this question notification because you are a member of
Sikuli Drivers, which is an answer contact for Sikuli.