[check] replacing existing image file with new content on the fly is not recognised (old image still used) --- workaround

Bug #1402185 reported by RaiMan
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
SikuliX
In Progress
Medium
RaiMan

Bug Description

**** workaround see comment #1

--- from bug 1402048
capturing and replacing an existing image in the current test won't be found on screen
(assume the image won't be found before capturing).

Here an example code for capturing and replacing an image:

import os, shutil
f = capture(Region(0, 0, 500, 400))
shutil.copy(f, os.path.join(getBundlePath(), 'test.png'))
find(Pattern("test.png").exact())

Revision history for this message
RaiMan (raimund-hocke) wrote :

In version 1.1.0 we have an image cache, so when using an image again, it is loaded from memory and not again from file.
Since your approach is hidden to SikuliX (I do not check for external changes of the image file), after the replace of the file, the old memory content is still taken.

To avoid this effect, you either have to switch off image caching from the beginning
Settings.setImageCache(0) # is 64 MB otherwise

or say
Image.reset()
after your external replace (which will clear the cache, so caching starts all over again after that)

I am sorry, but I have not yet textually documented all aspects of version 1.1.0 at
http://sikulix-2014.readthedocs.org/en/latest/index.html

... but to get information about classes like Image and their methods you might have a look into the nightly javadocs:
http://nightly.sikuli.de/docs/index.html

For version 1.2, I will revise the Image handling again and will allow, to replace a cached image with captured content including save to an image file.

Changed in sikuli:
status: New → In Progress
importance: Undecided → Medium
assignee: nobody → RaiMan (raimund-hocke)
milestone: none → 1.2.0
summary: [1.1.0] replacing existing image file with new content on the fly is not
- recognised (old image still used)
+ recognised (old image still used) --- workaround
RaiMan (raimund-hocke)
summary: - [1.1.0] replacing existing image file with new content on the fly is not
+ [check] replacing existing image file with new content on the fly is not
recognised (old image still used) --- workaround
Changed in sikuli:
milestone: 2.0.0 → 2.0.1
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.