Link to home
Start Free TrialLog in
Avatar of Mateen
Mateen

asked on

Compare 2 bitmap image.

In pb7, is it possible to compare two bitmap images to verify if they are identical or not?
Avatar of tsirakua1
tsirakua1

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
Avatar of Mateen

ASKER

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
ASKER CERTIFIED SOLUTION
Avatar of tsirakua1
tsirakua1

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial