Question #704427 on SikuliX changed:
https://answers.launchpad.net/sikuli/+question/704427

RaiMan proposed the following answer:
Ok, this is a possible workaround in 2.0.5 in Java:

it is only the basic approach to get an image from a jar as a SikuliX
useable object.

- make sure, that the jar containing the images has a class def and is
on the classpath at runtime

    Class<?> aClass = Class.forName("<someClassDef>"); // locate the class ref
    URL url = aClass.getResource("<imageFolder/image.png>"); // locate the 
image as jar url
    Image image = Image.create(url); // create an Image object to use with the 
Region and Pattern classes
    Match match = new Screen().exists(image); // try to find the image on screen

- <someClassDef> a class in the images jar (in my case:
com.sikulix.JarImages as main class)

- <imageFolder/image.png>  an image in the jar (in my case:
/jarimages/jarimg.png)

- my case: jar content:
/com/sikulix/JarImages.class
/jarimages/jarimages.py
/jarimages/jarimg.png
/META-INF/...

before packing the jar (with Maven in my case) you can build the image
list in the IDE using the jarimages as scriptfolder

-- 
You received this question notification because your team Sikuli Drivers
is an answer contact for SikuliX.

_______________________________________________
Mailing list: https://launchpad.net/~sikuli-driver
Post to     : sikuli-driver@lists.launchpad.net
Unsubscribe : https://launchpad.net/~sikuli-driver
More help   : https://help.launchpad.net/ListHelp

Reply via email to