Re: How to compare 2 images from command line

2008-09-03 Thread DA Forsyth
On 2 Sep 2008 , [EMAIL PROTECTED] entreated about
 freebsd-questions Digest, Vol 231, Issue 5:

  Yes, there's a huge difference between testing differences in images and 
  testing differences in files.  What do you mean by ...know if the 
  display is working correctly.?
  
  Andrew
 
 I want to determine if Mplayer is working correctly. The best way to be 
 sure is to check if the display on the screen is changing. That's the 
 purpose of the screenshots. The screenshots are taken by Nagios every 5 
 minutes and the new screenshot is compared with the preceding one. But, 
 by now, it doesn't work because every tool we try is seeing a diffence 
 between 2 identical images.

JPG format will always be different because of the 
encoding/compression.  I think you need to save to an uncompressed 
format like BMP.  Maybe PNG has a mode that will work too.  BMP has 
no info headers, just the raw data, so that won't be affected by the 
time of the save (at the least).


--
   DA Fo rsythNetwork Supervisor
Principal Technical Officer -- Institute for Water Research
http://www.ru.ac.za/institutes/iwr/


___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


How to compare 2 images from command line

2008-09-02 Thread FreeBSD

Hi everyone,

I'm trying to determine if 2 jpeg images are identical. The images are 
screenshots taken with scrot at different times. The point is to know if 
the display is working correctly. I tried to use 'diff' but without 
success, probably because of the metadata included in the image. I also 
tried the 'compare' command from imagemagick, but it produce an image 
containing the difference between the 2 images instead of telling me if 
both images are identical.


So, my question is what are you using to determine if 2 images are 
identical?


I'm using FreeBSD 7.0 and I need to be able to script this comparaison 
for an integration in Nagios.


Thank you,

Martin
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread Julien Cigar
/sbin/md5 image1.ext image2.ext ?

On Tue, 2008-09-02 at 11:02 -0400, FreeBSD wrote:
 Hi everyone,
 
 I'm trying to determine if 2 jpeg images are identical. The images are 
 screenshots taken with scrot at different times. The point is to know if 
 the display is working correctly. I tried to use 'diff' but without 
 success, probably because of the metadata included in the image. I also 
 tried the 'compare' command from imagemagick, but it produce an image 
 containing the difference between the 2 images instead of telling me if 
 both images are identical.
 
 So, my question is what are you using to determine if 2 images are 
 identical?
 
 I'm using FreeBSD 7.0 and I need to be able to script this comparaison 
 for an integration in Nagios.
 
 Thank you,
 
 Martin
 ___
 freebsd-questions@freebsd.org mailing list
 http://lists.freebsd.org/mailman/listinfo/freebsd-questions
 To unsubscribe, send any mail to [EMAIL PROTECTED]
-- 
Julien Cigar
Belgian Biodiversity Platform
http://www.biodiversity.be
Université Libre de Bruxelles (ULB)
Campus de la Plaine CP 257
Bâtiment NO, Bureau 4 N4 115C (Niveau 4)
Boulevard du Triomphe, entrée ULB 2
B-1050 Bruxelles
Mail: [EMAIL PROTECTED]
@biobel: http://biobel.biodiversity.be/person/show/471
Tel : 02 650 57 52

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread FreeBSD

Tom Marchand a écrit :

Hash the images and compare the hashes.

 -- Original message --
From: FreeBSD [EMAIL PROTECTED]

Hi everyone,

I'm trying to determine if 2 jpeg images are identical. The images are 
screenshots taken with scrot at different times. The point is to know if 
the display is working correctly. I tried to use 'diff' but without 
success, probably because of the metadata included in the image. I also 
tried the 'compare' command from imagemagick, but it produce an image 
containing the difference between the 2 images instead of telling me if 
both images are identical.


So, my question is what are you using to determine if 2 images are 
identical?


I'm using FreeBSD 7.0 and I need to be able to script this comparaison 
for an integration in Nagios.


Thank you,

Martin


I just tried it and it doesn't work. The hashes are different. I can't
say that I'm surprised since 'diff' is seeing a difference between the
two identical images.


Thanks for the suggestion



___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread Andrew Gould
On Tue, Sep 2, 2008 at 10:23 AM, FreeBSD [EMAIL PROTECTED] wrote:

 Tom Marchand a écrit :

 Hash the images and compare the hashes.

  -- Original message --
 From: FreeBSD [EMAIL PROTECTED]

 Hi everyone,

 I'm trying to determine if 2 jpeg images are identical. The images are
 screenshots taken with scrot at different times. The point is to know if the
 display is working correctly. I tried to use 'diff' but without success,
 probably because of the metadata included in the image. I also tried the
 'compare' command from imagemagick, but it produce an image containing the
 difference between the 2 images instead of telling me if both images are
 identical.

 So, my question is what are you using to determine if 2 images are
 identical?

 I'm using FreeBSD 7.0 and I need to be able to script this comparaison
 for an integration in Nagios.

 Thank you,

 Martin


 I just tried it and it doesn't work. The hashes are different. I can't
 say that I'm surprised since 'diff' is seeing a difference between the
 two identical images.


 Thanks for the suggestion


Yes, there's a huge difference between testing differences in images and
testing differences in files.  What do you mean by ...know if the display
is working correctly.?

Andrew
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread FreeBSD

Andrew Gould a écrit :



On Tue, Sep 2, 2008 at 10:23 AM, FreeBSD [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Tom Marchand a écrit :

Hash the images and compare the hashes.

 -- Original message --
From: FreeBSD [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

Hi everyone,

I'm trying to determine if 2 jpeg images are identical. The
images are screenshots taken with scrot at different times.
The point is to know if the display is working correctly. I
tried to use 'diff' but without success, probably because of
the metadata included in the image. I also tried the
'compare' command from imagemagick, but it produce an image
containing the difference between the 2 images instead of
telling me if both images are identical.

So, my question is what are you using to determine if 2
images are identical?

I'm using FreeBSD 7.0 and I need to be able to script this
comparaison for an integration in Nagios.

Thank you,

Martin


I just tried it and it doesn't work. The hashes are different. I can't
say that I'm surprised since 'diff' is seeing a difference between the
two identical images.


Thanks for the suggestion


Yes, there's a huge difference between testing differences in images and 
testing differences in files.  What do you mean by ...know if the 
display is working correctly.?


Andrew


I want to determine if Mplayer is working correctly. The best way to be 
sure is to check if the display on the screen is changing. That's the 
purpose of the screenshots. The screenshots are taken by Nagios every 5 
minutes and the new screenshot is compared with the preceding one. But, 
by now, it doesn't work because every tool we try is seeing a diffence 
between 2 identical images.


Thank you for your interest
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread Wojciech Puchar
I'm trying to determine if 2 jpeg images are identical. The images are 
screenshots taken with scrot at different times. The point is to know if the 
display is working correctly. I tried to use 'diff' but without success, 
probably because of the metadata included in the image. I also tried the


cmp does byte-to byte comparision.

if you want to make sure uncompressed bitmaps are the same then uncompress 
(cmp) and then compare

___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread Polytropon
On Tue, 02 Sep 2008 11:31:49 -0400, FreeBSD [EMAIL PROTECTED] wrote:
 I want to determine if Mplayer is working correctly. The best way to be 
 sure is to check if the display on the screen is changing. That's the 
 purpose of the screenshots.

And this works? I always thought mplayer would output the video
stream via DRI / DRM, so on the screenshot, nothing would be seen...



 The screenshots are taken by Nagios every 5 
 minutes and the new screenshot is compared with the preceding one. But, 
 by now, it doesn't work because every tool we try is seeing a diffence 
 between 2 identical images.

The images may be identical in content, but it's completely possible
that other data (others than the pictural information) is coded into
the file, for example date and time of creation, so the files may be
different, while the pictures they show are identical.

It would be useful first to decompile the files - create a new file
that only contains pictural information, nothing more.



-- 
Polytropon
From Magdeburg, Germany
Happy FreeBSD user since 4.0
Andra moi ennepe, Mousa, ...
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread Bill Moran
In response to FreeBSD [EMAIL PROTECTED]:

 Andrew Gould a écrit :
  
  
  On Tue, Sep 2, 2008 at 10:23 AM, FreeBSD [EMAIL PROTECTED] 
  mailto:[EMAIL PROTECTED] wrote:
  
  Tom Marchand a écrit :
  
  Hash the images and compare the hashes.
  
   -- Original message --
  From: FreeBSD [EMAIL PROTECTED]
  mailto:[EMAIL PROTECTED]
  
  Hi everyone,
  
  I'm trying to determine if 2 jpeg images are identical. The
  images are screenshots taken with scrot at different times.
  The point is to know if the display is working correctly. I
  tried to use 'diff' but without success, probably because of
  the metadata included in the image. I also tried the
  'compare' command from imagemagick, but it produce an image
  containing the difference between the 2 images instead of
  telling me if both images are identical.
  
  So, my question is what are you using to determine if 2
  images are identical?
  
  I'm using FreeBSD 7.0 and I need to be able to script this
  comparaison for an integration in Nagios.
  
  Thank you,
  
  Martin
  
  
  I just tried it and it doesn't work. The hashes are different. I can't
  say that I'm surprised since 'diff' is seeing a difference between the
  two identical images.
  
  
  Thanks for the suggestion
  
  
  Yes, there's a huge difference between testing differences in images and 
  testing differences in files.  What do you mean by ...know if the 
  display is working correctly.?
  
  Andrew
 
 I want to determine if Mplayer is working correctly. The best way to be 
 sure is to check if the display on the screen is changing. That's the 
 purpose of the screenshots. The screenshots are taken by Nagios every 5 
 minutes and the new screenshot is compared with the preceding one. But, 
 by now, it doesn't work because every tool we try is seeing a diffence 
 between 2 identical images.

Can you put the screenshots into some other format?  As you mentioned,
the jpeg format includes metadata, which might include the creation
time and would cause every image to be unique from a filesystem view.
For example, I don't believe bitmaps include metadata, which would cause
them to be identical if the display were identical.

-- 
Bill Moran
http://www.potentialtech.com
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread FreeBSD

Bill Moran a écrit :

In response to FreeBSD [EMAIL PROTECTED]:


Andrew Gould a écrit :


On Tue, Sep 2, 2008 at 10:23 AM, FreeBSD [EMAIL PROTECTED] 
mailto:[EMAIL PROTECTED] wrote:


Tom Marchand a écrit :

Hash the images and compare the hashes.

 -- Original message --
From: FreeBSD [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

Hi everyone,

I'm trying to determine if 2 jpeg images are identical. The
images are screenshots taken with scrot at different times.
The point is to know if the display is working correctly. I
tried to use 'diff' but without success, probably because of
the metadata included in the image. I also tried the
'compare' command from imagemagick, but it produce an image
containing the difference between the 2 images instead of
telling me if both images are identical.

So, my question is what are you using to determine if 2
images are identical?

I'm using FreeBSD 7.0 and I need to be able to script this
comparaison for an integration in Nagios.

Thank you,

Martin


I just tried it and it doesn't work. The hashes are different. I can't
say that I'm surprised since 'diff' is seeing a difference between the
two identical images.


Thanks for the suggestion


Yes, there's a huge difference between testing differences in images and 
testing differences in files.  What do you mean by ...know if the 
display is working correctly.?


Andrew
I want to determine if Mplayer is working correctly. The best way to be 
sure is to check if the display on the screen is changing. That's the 
purpose of the screenshots. The screenshots are taken by Nagios every 5 
minutes and the new screenshot is compared with the preceding one. But, 
by now, it doesn't work because every tool we try is seeing a diffence 
between 2 identical images.


Can you put the screenshots into some other format?  As you mentioned,
the jpeg format includes metadata, which might include the creation
time and would cause every image to be unique from a filesystem view.
For example, I don't believe bitmaps include metadata, which would cause
them to be identical if the display were identical.



Thank you! It did the trick. I just converted the image from png (sorry 
it wasn't jpeg...) to bmp and it works with cmp. Even diff now recognize 
both images as identical.


Thanks everyone for your support.

Martin
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread FreeBSD

Polytropon a écrit :

On Tue, 02 Sep 2008 11:31:49 -0400, FreeBSD [EMAIL PROTECTED] wrote:
I want to determine if Mplayer is working correctly. The best way to be 
sure is to check if the display on the screen is changing. That's the 
purpose of the screenshots.


And this works? I always thought mplayer would output the video
stream via DRI / DRM, so on the screenshot, nothing would be seen...



Yes it works. I don't know how scrot takes it's screenshot but it does 
it well ;)


The screenshots are taken by Nagios every 5 
minutes and the new screenshot is compared with the preceding one. But, 
by now, it doesn't work because every tool we try is seeing a diffence 
between 2 identical images.


The images may be identical in content, but it's completely possible
that other data (others than the pictural information) is coded into
the file, for example date and time of creation, so the files may be
different, while the pictures they show are identical.

It would be useful first to decompile the files - create a new file
that only contains pictural information, nothing more.










___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread Andrew Gould
On Tue, Sep 2, 2008 at 10:31 AM, FreeBSD [EMAIL PROTECTED] wrote:

 Andrew Gould a écrit :



 On Tue, Sep 2, 2008 at 10:23 AM, FreeBSD [EMAIL PROTECTED]mailto:
 [EMAIL PROTECTED] wrote:

Tom Marchand a écrit :

Hash the images and compare the hashes.

 -- Original message --
From: FreeBSD [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED]

Hi everyone,

I'm trying to determine if 2 jpeg images are identical. The
images are screenshots taken with scrot at different times.
The point is to know if the display is working correctly. I
tried to use 'diff' but without success, probably because of
the metadata included in the image. I also tried the
'compare' command from imagemagick, but it produce an image
containing the difference between the 2 images instead of
telling me if both images are identical.

So, my question is what are you using to determine if 2
images are identical?

I'm using FreeBSD 7.0 and I need to be able to script this
comparaison for an integration in Nagios.

Thank you,

Martin


I just tried it and it doesn't work. The hashes are different. I can't
say that I'm surprised since 'diff' is seeing a difference between
 the
two identical images.


Thanks for the suggestion


 Yes, there's a huge difference between testing differences in images and
 testing differences in files.  What do you mean by ...know if the display
 is working correctly.?

 Andrew


 I want to determine if Mplayer is working correctly. The best way to be
 sure is to check if the display on the screen is changing. That's the
 purpose of the screenshots. The screenshots are taken by Nagios every 5
 minutes and the new screenshot is compared with the preceding one. But, by
 now, it doesn't work because every tool we try is seeing a diffence between
 2 identical images.

 Thank you for your interest


Are you simply trying to determine whether the mplayer has finished playing
a movie (that you're not watching)?  It seems to me that the fact that the
image changes is not a good indication that mplayer is working correctly,
only that the movie isn't running.
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread FreeBSD

andrew clarke a écrit :

On Tue 2008-09-02 11:57:35 UTC-0400, FreeBSD ([EMAIL PROTECTED]) wrote:


Can you put the screenshots into some other format?  As you mentioned,
the jpeg format includes metadata, which might include the creation
time and would cause every image to be unique from a filesystem view.
For example, I don't believe bitmaps include metadata, which would cause
them to be identical if the display were identical.
Thank you! It did the trick. I just converted the image from png (sorry  
it wasn't jpeg...) to bmp and it works with cmp. Even diff now recognize  
both images as identical.


Before I read this I was going to suggest you could try removing the
metadata using something like jhead.  As it turns out, you say you're
using PNG format images, not JPEGs, but perhaps there's an equivalent
to jhead to work with metadata in PNG files - just as an
alternative to converting each PNG to BMP (which could be CPU intensive).

Regards
Andrew


Thank you for your almost-suggestion ;)

The screenshot are taken once every 5 minutes and the conversion was 
pretty instant. I don't think it will be a problem in our case.


Martin
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]


Re: How to compare 2 images from command line

2008-09-02 Thread andrew clarke
On Tue 2008-09-02 11:57:35 UTC-0400, FreeBSD ([EMAIL PROTECTED]) wrote:

 Can you put the screenshots into some other format?  As you mentioned,
 the jpeg format includes metadata, which might include the creation
 time and would cause every image to be unique from a filesystem view.
 For example, I don't believe bitmaps include metadata, which would cause
 them to be identical if the display were identical.

 Thank you! It did the trick. I just converted the image from png (sorry  
 it wasn't jpeg...) to bmp and it works with cmp. Even diff now recognize  
 both images as identical.

Before I read this I was going to suggest you could try removing the
metadata using something like jhead.  As it turns out, you say you're
using PNG format images, not JPEGs, but perhaps there's an equivalent
to jhead to work with metadata in PNG files - just as an
alternative to converting each PNG to BMP (which could be CPU intensive).

Regards
Andrew
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to [EMAIL PROTECTED]