R – New image taken with camera different than same image loaded from camera roll

cameraiphoneuiimagepickercontroller

When I get a new image taken by the user with the camera and save its checksum, when the user later reloads that same image from the camera roll, the checksum is different. Could this be because the image saved in camera roll is in JPG format, which is lossy, and therefore its pixels are different? I am trying to use the checksum to detect that it is the same image: any idea how to overcome this situation? Do I need to save it as a JPG myself, then read it into memory so that I can get the same bytes that I will get from the camera roll later? If I do, I would also need to be sure that I save the same JPG format as the camera roll …

Thanks!
Patrick

Best Answer

I'm not an iPhone expert but I know that when saving a JPEG, there are many "quality" parameters, and if an image is encoded to JPEG format with slightly different parameters, the pixel values will be different.

So unless you can find a way to reliably convert an image to JPEG using exactly the same process as camera roll, converting the image to JPEG yourself isn't going to be of much use.

If it's possible to read the creation time of images in the camera roll, or some similar metadata, this would probably be a better method.

Related Topic