Randomly Generated Photo Sliding Puzzle

Hello, I am trying to make an app that finds a random photo and turns it into tiles so that they can be shuffled to be solved in a sliding puzzle. I'm stuck with this though, can anyone help.