Diff two iPhoto libraries to check if they contain the duplicate photos

Create a new library,

import the images from both libraries (https://support.apple.com/en-us/119920)

View > Utilities > Duplicates

or use jdupes or czkawka on both directories.

Great tip, but also: exactly.

On the phone itself?

On the filesystem-enabled device called Mac commonly used for semi-pro operations like file management and backup.