Earlier quoted context omitted.
Obviously an image picker shouldn't leak filenames... The filename is a property of the directory entry storing the file storing the image. The image picker only grants access to the image, not to directories, directory entries or files. If you want filenames, you need to request access to a directory, not to an image
The path is different than the filename though. If I want to find duplicates, it will be impossible if the filename changes. In my use case /User/user/Images/20240110/happy_birthday.jpg and /User/user/Desktop/happy_birthday.jpg are the same image.
Depends on what is meant by a "duplicate." It would be a good idea to get a checksum of the file, which can detect exact data duplicates, but not something where metadata is removed or if the image was rescaled. Perceptual hashing is more expensive but is better distinguish matches between rescaled or cropped images.