Hi All,
I have two identical PDF files, say file1 and file2. I used an API
package to extract the bitmap in each PDF file, say bitmap1 (in file1)
and bitmap2 (in file2). Since the bitmaps are same in both files, I
expect bitmap1.Equals (bitmap2) to return true. However, it's false.
FYI:
1) I've copied file1 to file2, therefore, the bitmap images in both
files are exactly the same;
2) The API gets the correct bitmap image in either file because I'm
able to save either to a ".tif" file, and am also able to display it in
a PictureBox control.
Could anyone tell me why?
Thanks!
-Emily 3 2716
Fir5tSight <fi********@yah oo.comwrote:
I have two identical PDF files, say file1 and file2. I used an API
package to extract the bitmap in each PDF file, say bitmap1 (in file1)
and bitmap2 (in file2). Since the bitmaps are same in both files, I
expect bitmap1.Equals (bitmap2) to return true. However, it's false.
FYI:
1) I've copied file1 to file2, therefore, the bitmap images in both
files are exactly the same;
2) The API gets the correct bitmap image in either file because I'm
able to save either to a ".tif" file, and am also able to display it in
a PictureBox control.
Could anyone tell me why?
Yes - Bitmap and Image don't override Equals. In this case, I'm not
entirely surprised - there are plenty of candidates for having an
Equals override before we get down to images. The number of developers
whoe would use it is probably very small compared with, say, Array.
--
Jon Skeet - <sk***@pobox.co m> http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Hello, Emily,
As Jon says, Equals hasn't been overridden for this type. This means
that Equals will be True for two Image type variables only if they refer
to the same object. Equals between two distinct image objects will
return False even if those objects hold exactly the same data. (I guess
this is essentially the same thing as the "Is" operator in VB.)
You and I seem to be among that very small number of developers that Jon
refers to who would prefer that Image.Equals had been overridden to
provide value equality.
In my case, I loaded the images into a byte arrays to compare them.
Perhaps someone can provide suggestions for a better way to do this. (I
imagine that there is one, but didn't have time to seek it out.)
Cheers,
Randy
Fir5tSight wrote:
Hi All,
I have two identical PDF files, say file1 and file2. I used an API
package to extract the bitmap in each PDF file, say bitmap1 (in file1)
and bitmap2 (in file2). Since the bitmaps are same in both files, I
expect bitmap1.Equals (bitmap2) to return true. However, it's false.
FYI:
1) I've copied file1 to file2, therefore, the bitmap images in both
files are exactly the same;
2) The API gets the correct bitmap image in either file because I'm
able to save either to a ".tif" file, and am also able to display it in
a PictureBox control.
Could anyone tell me why?
Thanks!
-Emily
Hi Randy, Jon,
Many thanks for answering my question! I'll do what you suggest - To
load the images into two byte arrays and compare the arrays.
-Emily This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Zeng |
last post by:
I'm trying to comparing 2 objects (pointer to object) to see if they are the
"same" as each other. Here is what the definition of being the "same"
object type for both objects, object 1, object 2, same?
-----------------------------------------------------------
Decimal 199677 199677 yes
String "hello" "hello" yes
null null
yes
|
by: Frank Wisniewski |
last post by:
Is this suppose to work like this:
I have a class called foo in which I tried to override equals and return
different answers based on what was passed in.
public class foo
{
private string _name;
|
by: Kurt |
last post by:
Wouldn't you agree all of the follwoing should produce the same
result?
r = (o1 == o2);
r = (o2 == o1);
r = object.Equals(o1, o2);
r = object.Equals(o2, o1);
r = (o1.Equals(o2));
r = (o2.Equals(o1));
|
by: Chris |
last post by:
This is something that has been bugging me for some time. When exactly
should I be using == instead of .Equals() ?
I see a lot of code that performs object evaluation e.g. Is Object1 the
same as Object2 by using == which works but shouldn't it be using
.Equals()? e.g. Object1.Equals(Object2)
I believe == should be using for simple type evaluation e.g.
int a = 0;
|
by: Rubbrecht Philippe |
last post by:
Hi there,
According to documentation I read the ArrayList.IndexOf method uses the
Object.Equals method to loop through the items in its list and locate the
first index of an item that returns True.
Therefore, overriding the Equals method in the class definition of the items
I put in the ArrayList should make the IndexOf method use my version of the
Equals method?!
| |
by: JohnR |
last post by:
From reading the documentation, this should be a relatively easy thing. I
have an arraylist of custom class instances which I want to search with
an"indexof" where I'm passing an instance if the class where only the
"searched" property has a value. I expected to get the index into the
arraylist where I could then get the entire class instance. However, the
'indexof' is never calling my overloaded, overrides Equals method. Here is
the...
|
by: cody |
last post by:
Why can I overload operator== and operator!= separately having different
implementations and additionally I can override equals() also having a
different implementation.
Why not forbid overloading of == and != but instead translate each call
of objA==objB automatically in System.Object.Equals(objA, objB).
This would remove inconsistencies like
myString1==myString2
|
by: Omiris |
last post by:
I'm trying to use the Equals() method that is defined on the List(Of T) class. The docs seem to state that if T implements the IEquatable interface, then it will use the Equals method that is declared there in order to do an Equals() call on the List itself.
So I create a class called ExportStream which implements IEquatable (and the Object.Equals method as well). Next when I put the instances of ExportStream into lists and compare, the Lists...
|
by: r035198x |
last post by:
The Object class has five non final methods namely equals, hashCode, toString, clone, and finalize.
These were designed to be overridden according to specific general contracts. Other classes that make use of these methods assume that the methods obey these contracts so it is necessary to ensure that if your classes override these methods, they do so correctly.
In this article I'll take a look at the equals and hashCode methods.
...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
| |
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
by: 6302768590 |
last post by:
Hai team
i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
| |