Solved

Comparing Pictures

Posted on 2000-05-01
5
2,917 Views
Last Modified: 2008-02-26
Hello there!
Say I have two picture boxes, Picture1 and Picture2 and I want to compare the content of them. Is there a way for me to find out if the content is equal in the two picture boxes?

Martin
0
Comment
Question by:martinag
  • 2
  • 2
5 Comments
 
LVL 9

Accepted Solution

by:
Ruchi earned 100 total points
ID: 2766808
http://www.planetsourcecode.com/vb/scripts/ShowCode.asp?lngWId=1&txtCodeId=7240

"The code can flip pictures, invert them using 3 different methods, compare pictures, divides the Picture into its three main channels and it combines them to one"
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2766905
assuming the two pictures are the same scale then you can do this:

function compare()
for i = 0 to picture1.scalewidth
   for j = o t0 picture1.scaleheight
      color1 = picture1.point(i,j)
      color2 = picture2.point(i,j)
      if color1 <> color2 then
         msgbox "not equal"
         exit function
      end if
   next
next
msgbox "equal"
end function
0
 
LVL 4

Author Comment

by:martinag
ID: 2767002
Thanks both of you. Seems stupid not to have an API-call for this task. Anyway, the points go to the first poster - sorry AzraSound . . .

Martin
0
 
LVL 9

Expert Comment

by:Ruchi
ID: 2767005
From the link I posted, I pulled some code. The following code is simliar to ArazSound's code.

Place a command button on the form.

Private Sub Command1_Click()
Dim s As Boolean

sw = Picture1(0).ScaleWidth
sh = Picture1(0).ScaleHeight

s = True
For i = 0 To sw
For j = 0 To sh
    col1 = Picture1(0).Point(i, j)
    col2 = Picture1(4).Point(i, j)
    If col1 <> col2 Then
        s = False
        GoTo endw
    End If
Next j
Next i
endw:
If s Then
MsgBox "OK"
Else
MsgBox "Net OK"
End If
End Sub
0
 
LVL 28

Expert Comment

by:AzraSound
ID: 2767018
there may be api to do it, though i've never worked with it before. you can get the entire color table from a dib so i suppose there is a way to compare those color tables once you extract them from the two respective pictures.

if youre interested, check out info at msdn regarding:

getdibcolortable
0

Featured Post

Networking for the Cloud Era

Join Microsoft and Riverbed for a discussion and demonstration of enhancements to SteelConnect:
-One-click orchestration and cloud connectivity in Azure environments
-Tight integration of SD-WAN and WAN optimization capabilities
-Scalability and resiliency equal to a data center

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

821 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question