You could hash the image with MD5 or similar and store that along with the picture. Then whenever a new picture is uploaded, compare the MD5 hashes and only store it if different.
This assumes people are actually uploading the same image file for some reason. Not just a picture of the same thing. If you wanted to screen out pictures of the same subject, then you’d need an AI of some sort or a quite sophisticated image detection algorithm. If you could build one of those that worked well, google or somebody would probably pay you big bucks for it.
If the image will have a public address you can check if the resource exists with a http request.
If your upload method use a script on the server (php for example) you could write a script that return a json if the file exists (you know your rule to check if the file is the same: same hash, same name, same color on a pixel). again an http request with the parameters you need to check this existence
You can use the MD5 or any of Antonio’s methods to see if the file is exactly the same as one that’s been previously uploaded. If you’re trying to match image content, you’ll need a service like https://tineye.com/products
So I guess I am not sure what the actual usage is. Are you saying your code is uploading an image to a server that you don’t control, but before uploading you want to check if the image is already there?
In that case you could check if a file of the same name and size is already there using a list command or whatever option is available on the server you’re uploading to.
If you don’t control the server though then your options may be limited. Maybe you could be more specific about your application and how it works so we could give you better guidance.
Dante, you’ll have to create a method somewhere that compares the pictures in some way, but that depends on your requirements. That requires a better understanding of your definition of “the same”.
identical, as in the same exact file, taken from the exact source and hasn’t been altered in any way.
similar, identical, but perhaps resaved (because that can cause pixels to change if a new profile, format or compression setting is applied.
content, they both have the same subject, like Cats.
These three are increasingly difficult as others have indicated, but until you define the level of “same-ness” you are after, no one here can even begin to guide you.
FWIW, in Xojo all of these require uploading the image before you can tell anything.