You can use ImageMagick's compare to actually visualize the difference
as described in this post 
http://dtmilano.blogspot.com/2011/04/monkeyrunner-visual-image-comparison.html.


On Apr 16, 6:34 pm, lsim001 <[email protected]> wrote:
> Hi guys,
> I've actually worked out how to solve the problem.  Well...the result
> of the problem.  i am not going to speculate why the screenshots are
> not correct.
>
> Anyway, what I've done is to just take 2 screenshots and compare them
> until they are the same.  This has worked well for me.  Here's how I'm
> doing it.  Although I only set the image comparison at 50% match the
> images usually turn out to be exactly the same to my eyes.
>
> Hope this helps.
>
> stableImage = False
>
>     while stableImage == False:
>         result = device.takeSnapshot()
>         MonkeyRunner.sleep(1)
>         result2 = device.takeSnapshot()
>         stableImage = result2.sameAs(result, 0.5)
>         print stableImage, ' -- image stabilizing...'
>
>     MonkeyRunner.sleep(shortSleepInterval)
>     result2.writeToFile(filename,'png')
>
> On Apr 4, 7:45 am, Diego Torres Milano <[email protected]> wrote:
>
>
>
>
>
>
>
> > In some cases, after trial and error, I had to add up to 3 secs.
>
> > On Apr 3, 2:28 pm, SJ <[email protected]> wrote:
>
> > > Thanks Diego.
> > > (Actually Im using your approach with Eclipse but on MAC. Works well.
> > > But not manage on Win.)
>
> > > MonkeyRunner.sleep(1.0)
> > > result = device.takeSnapshot()
> > > MonkeyRunner.sleep(1.0)
>
> > > This made me perfect screenshot.
>
> > > On Apr 2, 10:43 pm, Diego Torres Milano <[email protected]> wrote:
>
> > > > Add more delay to see it this solves the problem.
>
> > > > On Apr 2, 1:56 pm, SJ <[email protected]> wrote:
>
> > > > > I have also seen not 100% perfect screenshot.
> > > > > There is only one function in Monkeyrunner to take Snapshots:
>
> > > > > com.android.monkeyrunner.MonkeyDevice.takeSnapshot
> > > > > Gets the device's screen buffer, yielding a screen capture of the
> > > > > entire display.
>
> > > > > Which function have you mention?
>
> > > > > On Mar 31, 2:31 am, lbendlin <[email protected]> wrote:
>
> > > > > > Are you taking the screenshots from the framebuffer? You may want 
> > > > > > to use a
> > > > > > more higher level function that will only execute when the whole 
> > > > > > screen is
> > > > > > blitted.

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to