Be warned, there are strobe lights and rapidly flashing images ahead.

LASAGNA.EXE is my personal favorite Twitter bot, check it out here. Behold:

a glitched out Garfield comic strip


Every single person on Earth knows about the lazy cat who hates Mondays and loves lasagna. That’s just a dang fact and you can quote me.

There’s not much to Garfield: three panels, a bad-to-terrible joke about Lasagna or Monday or Jon’s social anxiety or abusing Odie or some combination of these things. I suspect that there have been nearly identical Garfield comics produced decades apart but I don’t have the mental fortitude to go out and confirm that fact.

I’ve always loved Garfield ‘remixes,’ taking the iconic lazy cat and making something weird from the imagery. My favorites are Lasagna Cat, Garfield Minus Garfield[1], and the Random Garfield Generator.

I wanted to make my own contribution to the wide, weird world of Garfield remixes, so I came up with LASAGNA.EXE.

The idea is to take a number of actual Garfield strips, glitch them visually, add some randomly generated text based on the entire history of Garfield, and then upload the result to Twitter. This will happen every hour, on the hour, until the heat-death of the Sun (or until Heroku or Twitter change something). That’s almost 9,000 glitched strips per year, baby baby.


LASAGNA.EXE is actually a Ruby program running on Heroku but that doesn’t sound as cool as LASAGNA.EXE.

To begin I needed a large collection of random Garfield strips to glitch out. Thankfully the archives for Garfield are sitting on the publisher’s web server and each strip has a well-formatted filename, so with a bit of trial and error I wrote a script that let me grab a random strip from 1988 to 2014 by filling in this URL accordingly:


I then download 30 random Garfield strips to /tmp so we can glitch ‘em out. Here’s a sample of how the glitch effects are performed. This is via RMagick which is a Ruby port of Imagemagick:

image = image.wave(rand(50), rand(50)) if roll_dice
image = image.solarize if roll_dice
image = image.blur_image(2, rand(1..10)) if roll_dice
image = image.radial_blur(rand(10)) if roll_dice

roll_dice is simply rand(3) == 2, so there’s a 1/3 chance that a given effect will happen.

After some cropping and additional glitching we end up with 30 glitched but static Garfield strips. On top of the glitched strips I use a Markov chain to add additional text on top of the strip. This Markov chain is based on scraped text from thousands of Garfield strips, so it ends up being about Odie and Lasagna quite often. Then we do a simple find-and-replace to turn some letters into non-letter characters, capitalize some random letters, and end up with something like this:

Jon. life is meaningle_s ANYwaY?

Then using RMagick’s annotate function, along with a Garfield.ttf font and some random coordinates, we throw this text on top of the glitched strip to add some more weirdness.

Finally, we stitch all 30 static strips together into an animated gif:

  anim = ImageList.new("tmp/gen_0.png", "tmp/gen_1.png", ...)
  anim.ticks_per_second = 100
  anim.delay = rand(5..10)
  anim.iterations = 0

The temporary static images are hardcoded into an RMagick ImageList. The speed of the animation is variable based on the delay setting, and iterations is set to zero for an infinite loop.

Then we generate one more Garkov sentence to use as the tweet’s body and upload it to the wild wild web with the Twitter gem. Voila!


This is, as I said, my favorite Twitter bot. It’s completely without purpose and vaguely abrasive, although learning automated image manipulation via RMagick has been useful for a few projects since then.

Ultimately, though, it’s nice to know that Twitter will be hosting thousands of glitched Garfield strips until the end of time at no cost to me. Many–well, most–of these glitches will never actually be seen by a human. If a glitched Garfield strip is uploaded to Twitter and nobody ever sees it, does it actually exist? Does anything???


[1] Garfield Minus Garfield was originally an unauthorized edit by some dude on the internet. It was pretty popular and eventually Jim Davis put out an official Garfield Minus Garfield book with himself as the author. He managed to get paid off of someone’s internet edit of his comic. It’s wild.