It is by no means certain that Charles I wrote Eikon Basilike. After the Restoration, John Gauden, bishop of Worcester, claimed to have written it. Scholars continue to disagree about the merits of this claim, though assuming that if Gauden wrote it, he had access to Charles's papers when he did so. Jeremy Taylor is also said to have had a hand in its revision, and to be the source of its title; an earlier draft bore the name Suspiria Regalia, the "Royal Sighs."
Some later editions of the Eikon Basilike contained a sworn statement by William Levett, Esq., longtime courtier and groom of the bedchamber to the King, that Levett had witnessed Charles writing the text during the time that Levett accompanied him in his imprisonment on the Isle of Wight. A witness to the King's execution, Levett later helped transport the King's body back to Windsor Castle for burial.
For details of the authorship controversy, one should consult, among others, the sources listed below, all of which are accessible through the Maryland Room in Hornbake Library. Additionally, Madan's New Bibliography of the Eikon Basilike (1950) gives an excellent summation of the authorship debate and an annotated list of works arising from it.