The cartoon may call back to events of 1795, where George III had stones thrown at him while he was on his way to the State Opening of Parliament. In response, the government - headed by Pitt the Younger, who is the man in the picture saying "That is treason, Johnny" - passed "An Act for the Safety and Preservation of His Majesty’s Person and Government against Treasonable and Seditious Practices and Attempts", 36 Geo. 3 c.7. We now call it the Treason Act 1795. It was one of a series of Acts that suspended habeas corpus, banned political meetings, and so on, in the wake of the French Revolution.
Section 1 deals with treason, at some length, but a fart probably doesn't count. The conditions are that somebody would:
within the Realm or without, compass, imagine, invent, devise, or intend Death or Destruction, or any bodily Harm tending to Death or Destruction, Maim or Wounding, Imprisonment or Restraint, of the Person of our same Sovereign Lord the King, his Heirs and Successors, or to deprive or depose him or them from the Style, Honour, or Kingly Name of the Imperial Crown of this Realm, or of any other of his Majesty’s Dominions or Countries; or to levy War against his Majesty, his Heirs or Successors, within his Realm, in order, by Force or Constraint, to compel him or them to change his or their Measures or Counsels, or in order to put any Force or Constraint upon, or to intimidate, or overawe, both Houses, or either House of Parliament; or to move or stir any Foreigner or Stranger with Force to invade this Realm, or any other of his Majesty’s Dominions or Countries, under the Obeisance of his Majesty, his Heirs or Successors; and such Compassings, Imaginations, Inventions, Devices, or Intentions, or any of them, shall express, utter, or declare, by publishing any Printing or Writing, or by any overt Act or Deed
The text is substantially preserved in the Treason Felony Act 1848, section 3. The 1795 Act also created a "High Misdemeanour" for anyone who
shall maliciously and advisedly, by Writing, Printing, Preaching, or other Speaking, express, publish, utter, or declare, any Words or Sentences to excite or stir up the People to hatred or Contempt of the Person of his Majesty, his Heirs or Successors, or the Government and Constitution of this Realm, as by Law established
This is closer to the fart; it is a lèse-majesté provision aimed at general disrespect for the King. The provision was due to expire in 1798. I do not know the detailed timeline of its expiry and proposed renewal in relation to when the cartoon was published, but this is a plausible connection to why it was a live issue again.
In Scotland, but not England, there were common-law offences of sedition and "leasing-making" covering the same sort of idea. They were abolished in 2010 but were long obsolete. Hume (Commentaries on the Law of Scotland, 1797) distinguishes between them by saying that leasing-making is solely verbal, a species of slander, whereas sedition is words or deeds "for the purpose of producing public trouble or commotion, and moving His Majesty's subjects to the dislike, resistance, or subversion of the established government and laws, or settled frame and order of things."
In any event, the political cartoon is satire and does not necessarily represent a legal reality. It is mocking Pitt's heavy-handedness in the Act of 1795, and perhaps challenging the authorities to define this very cartoon as criminal. Newton's mentor, William Holland, had been imprisoned for seditious libel for publishing Thomas Paine's Letter Addressed to the Addressers, on the Late Proclamation. The proclamation in question was the one of 1792 against seditious writing, also the work of Pitt, and aimed at Paine's Rights of Man, a work advocating for (among other things) freedom of the press and abolition of the monarchy. Therefore there is a specific personal and political edge to criticising Pitt's repressive legislation.