We help IT Professionals succeed at work.

New podcast episode! Our very own Community Manager, Rob Jurd, gives his insight on the value of an online community. Listen Now!

x

Compare 2 bitmap image.

Mateen
Mateen asked
on
627 Views
Last Modified: 2013-12-26
In pb7, is it possible to compare two bitmap images to verify if they are identical or not?
Comment
Watch Question

Hi!

You can read the two images into a blob variable an compare them to determinate if they are identical or not

To read the file into a blob variable do this:
string filename1,filename2
integer li_filenum, loops, i
long flen, bytes_read
blob b, tot_b1,tot_b2

li_filenum=fileopen(filename1,streammode!,read!,lockread!)
if flen>32765 then
      if mod(flen,32765)=0 then
            loops=flen/32765
      else
            loops=(flen/32765)+1
      end if
else
      loops=1
end if
for i=1 to loops
      bytes_read=fileread(li_filenum,b)
      tot_b1=tot_b1+b
next
fileclose(li_filenum)

li_filenum=fileopen(filename2,streammode!,read!,lockread!)
if flen>32765 then
      if mod(flen,32765)=0 then
            loops=flen/32765
      else
            loops=(flen/32765)+1
      end if
else
      loops=1
end if
for i=1 to loops
      bytes_read=fileread(li_filenum,b)
      tot_b2=tot_b2+b
next
fileclose(li_filenum)

if tot_b1=tot_b2 then
      messagebox("","The files are identical")
else
      messagebox("","The files are diferente")
end if

Cheers from Mexico

Author

Commented:
Hi tsiraku1

That's it.

Say, the images are saved into SQL2K table  table_x, column col_x. Then, how, this should be replaced.

filename1="C:\temp\capw.bmp"

The normal "Select col_x into :filename1 from .....etc"  or something else.

Thanks
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.