iPad 2 screen badly broken. How can i unlock the passcode since I can't see anything on the screen?

I have an iPad2 from a couple of years ago. There are lots of photos stored in there. My screen is broken and the iPad2 is locked. When I connect to iTunes, it asks for passcode which i cannot enter because the screen in broken. I don't even have any backed up data nor anything on the cloud. Is there a way I can retrieve my photos from a locked broken screen iPad2?
First get the screen fixed and then only you could input the code.

Original thread: https://forums.imore.com/threads/ipad-2-screen-badly-broken-how-can-i-unlock-the-passcode-since-i-cant-see-anything-on-the-screen.352182/