Your answer sounded so logical, I immediately tried it out. But it turns out that GD returns its data as real raw data, like it should be stored in a file, and that Tk::Photo takes data the way it produces it with the data() method, that is an ASCII string. Very strange, and I have no clue why anyone would want such a string...
So if anyone knows how to convert between these different formats, please let me know.