Can you imagine Willy Wonka being played by anyone else besides Johnny Depp in the 2005 film Charlie and the Chocolate Factory? Well, it turns out Jim Carrey did come close to playing the iconic chocolate factory owner.

Charlie and the Chocolate Factory is a 2005 film that was based on the 1964 novel written by Roald Dahl. Before this film, there was another adaptation called Willy Wonka & the Chocolate Factory, the 1971 classic that stars the late Gene Wilder.

The film follows a young boy named Charlie Bucket (Freddie Highmore) and his Grandpa Joe (David Kelly) as they take a tour of the infamous factory owned by candy maker Willy Wonka (Johnny Depp).

RELATED: 18 Fun Facts About The Making Of Charlie And The Chocolate Factory

Tim Burton did consider Carrey for the role of Willy Wonka, but he felt Johnny Depp was a better fit for the movie as he envisioned it, which is unsurprising, given how many other Burton films Depp has starred in.

Even though Depp got the role, Carrey would have done a good job as well. Since Willy Wonka is such an animated character, Carrey could have brought his own charm and energy to the part.

This isn’t the first role Carrey has lost to Depp. In the 90s, Carrey auditioned for the role of Edward Scissorhands. As we know, in the end, Depp got the role but Jim Carrey was up against other big names, too: He was being considered along with Tom Cruise and Robert Downey Jr.

At the early stages of his career, Carrey didn't really do dramatic acting. Some of his early work in the 90s include roles in Ace Ventura: Pet Detective, The Mask, and Dumb and Dumber.

RELATED: 15 BTS Facts About Jim Carrey And The Cast Of Dumb And Dumber

Edward Scissorhands was more of a serious role. So, he most likely would have approached the role with more of a comedic sense, which didn’t fit the character.

Carrey also auditioned for the role of Jack Sparrow in Pirates of the Caribbean: The Curse of the Black Pearl, along with Michael Keaton and Christopher Walken, Carrey was seriously considered for the role, but ultimately had to turn it down.

RELATED: Here's Why Jonny Depp Will Not Return For Pirates Of The Caribbean 6

He would’ve been great as Captain Jack, but the filming schedule for Bruce Almighty - which ended up being a massive success - would have conflicted with the first Pirates film. The role was later given to Depp, and the popular film franchise is still one of the biggest roles of Depp’s career.

Even though Carrey got rejected from these roles, it seems everything worked out for him. He still has a prominent career and is widely loved in Hollywood, and, after Bruce Almighty, he even started getting cast in more dramatic parts. Still, it's crazy to see how many times these two huge actors were pitted against one another for a part.

NEXT: Jim Carrey Calls Kanye West An 'Alien' In New Memoir