user1498119 user1498119 - 1 year ago 76
iOS Question

How to compare two UIImage objects

I am developing one application.In that i am using the

.SO before changeing the
image I need to take that image in
obejct and compare with another
object for finding both are sam or not. So please tell me how to do that one.

Answer Source

One way is to convert them to image data first, and then compare that.

- (BOOL)image:(UIImage *)image1 isEqualTo:(UIImage *)image2
    NSData *data1 = UIImagePNGRepresentation(image1);
    NSData *data2 = UIImagePNGRepresentation(image2);

    return [data1 isEqual:data2];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download