DEV Community

Cover image for How to Use ChatGPT to Make Weird SVG Art
Paul Salamone
Paul Salamone

Posted on

How to Use ChatGPT to Make Weird SVG Art

Vector-based imagery is the quiet workhorse of the digital art world. While raster-based photography and illustrations grab all the headlines, vector art — clean, scalable, performative — is found everywhere. It’s in your logos, in your icons, even in your language-learning app (remind me to tell you how bad my Turkish is btw).

And while some of the newer AI vector art generators show some promise, I’ve recently discovered that trusty ol’ ChatGPT is actually great at making REALLY BAD SVG ART. And all you have to do is ask!

Please return SVG code depicting a man.
Enter fullscreen mode Exit fullscreen mode

Then ChatGPT returns something like this:

<svg xmlns="http://www.w3.org/2000/svg" width="100" height="200" viewBox="0 0 100 200">
  <!-- Head -->
  <circle cx="50" cy="40" r="20" fill="black" />

  <!-- Body -->
  <line x1="50" y1="60" x2="50" y2="120" stroke="black" />

  <!-- Arms -->
  <line x1="50" y1="70" x2="30" y2="90" stroke="black" />
  <line x1="50" y1="70" x2="70" y2="90" stroke="black" />

  <!-- Legs -->
  <line x1="50" y1="120" x2="30" y2="160" stroke="black" />
  <line x1="50" y1="120" x2="70" y2="160" stroke="black" />
</svg>
Enter fullscreen mode Exit fullscreen mode

Which you can then just copy and paste into an HTML file using an online sandbox like CodeSandbox or Stackblitz and end up with something like THIS:

stick figure

Not much of anything yet, but you can iterate with ChatGPT. Let’s start with a background:

Please add a blue background, 
and make the SVG have a 3:2 aspect ratio. 
Also make the man's limbs thicker.
Enter fullscreen mode Exit fullscreen mode

…which returns code depicting this:

stick figure with blue background

Still looks like a 3-year old drawing on MS Paint. Let’s get more detailed:

Now give the man joints -- elbows and knees. 
Also turn the background into a cityscape at night.
Enter fullscreen mode Exit fullscreen mode

We get this:

stick figure at night

…and now it’s getting weird. But it can get even weirder!

Please make the background a lighter blue-grey. 
Make the man standing in a superhero pose. 
Also give him yellow slits for eyes, 
a tan jaw and black mouth. 
Also put a yellow horizontal ellipse on his chest. 
Also give him two black triangles on top of his head. 
And add some clouds and stars to the sky.
Enter fullscreen mode Exit fullscreen mode

Which returns this:

stick figure as bad version of batman

…and if you can’t tell I’m trying to get ChatGPT to draw Batman, that’s ChatGPT’s fault, not mine!

Actually, why don’t I just ask for that directly?

Hey ChatGPT, please draw me Batman using SVG.
Enter fullscreen mode Exit fullscreen mode

a weird black circle face with red nose

Way better! (Please note my sarcasm).

Alright let’s try something else:

Now please  return a new SVG image showing a man
in blue and red tights flying over a city.
Enter fullscreen mode Exit fullscreen mode

a crude vector drawing of a red and black striped bug man with a city in the background

Look, it’s Ant-Man’s cousin the Red Bee! What if I ask for

"Super Mario World" with an aspect ratio of 3:2.
Please have at least 40 shapes and 8 colors.
Enter fullscreen mode Exit fullscreen mode

a vaguely familiar abstract version of super mario world
…it’s kinda appropriate… right? We've got rolling hills, clouds, a "Mario" figure, etc. Let's try an even better (IMHO) 1990s videogame hero:

Sonic the Hedgehog
Enter fullscreen mode Exit fullscreen mode

a light blue hedgehog made of basic shapes

Ooh, shiny eyes! But otherwise, totally wrong. Alright let’s try one more time to get something that looks at least sort of normal.

Please depict Spider-Man!
Enter fullscreen mode Exit fullscreen mode

a crude red figure with black details

As you can see, ChatGPT isn’t coming for anyone’s vector art job yet (we’ll leave that to those b—stards at Adobe Firefly ;) ). But as a source of surprise and glitchy intrigue, it’s pretty fun. Stay turned for more SVG explorations!

Top comments (0)