CMA CMA - 29 days ago 27
Android Question

Comparing Bitmap images in Android

Is there any way to check if bitmaps are the same? can someone help me out?

Answer

Depending on how you define the same. If you mean the exact same file, you can do an md5sum of the files. That will be the same for every type of file I guess.

Because you specifically make the distinction for bitmap files, you might be interested in files that differ in size. That's a bit harder. If they are the same size, but not completely the same (but look really much like eachother) you can compare each separate pixel, and if enough pixels (threshold 1) are close enough to each other in color (threshold 2) you can declare them as being the same.

You can getPixel(int,int) to get the color, see this page