Logo
  • Home
  • Equipment
  • Tutorials
  • Calendar
  • TPZ Staff Page
  • (Beta) Tech Ai Support
Fab Lab Website
Fab Lab Website
Use AI and Python to make *.svg graphics
Use AI and Python to make *.svg graphics

Use AI and Python to make *.svg graphics

Project

Date Created
January 11, 2024
Author
U
Untitled
Tools & Skills
illustratorpythonai
[CoF] Careers of the Future
Launch Lab Connection
Competency
  • Introduction
  • Prerequisites
  • drawsvg setup
  • Wrangling Python
  • Setting up the library
  • First shapes
  • Programs
  • Generating code with AI chatbots
  • Vector Graphics from GPT-4 Turbo
an AI-generated *.svg image
Fig. 0: an AI-generated SVG image.

Introduction

AI image generation using tools like DALL-E is cool. But what about using AI text tools to generate code which produces graphics? The difference is subtle but useful for those of us in the digital fabrication realm; using these methods, we can directly produce vector graphics! No more image tracing! As an added bonus, we can also modify the code used to generate the graphics. Very nice.

Prerequisites

A basic familiarity with Python is helpful but not required for this tutorial. You can pick it up as you go by examining code snippets, just know that it may be more time-efficient to run through an introductory Python tutorial first. You will need access to a computer with sufficient permission to install software; note that once this part is completed you can continue as a normal user, so perhaps a proximate IT professional can assist with the initial set-up.

drawsvg setup

‣

Wrangling Python

‣

Setting up the library

‣

First shapes

‣

Programs

Generating code with AI chatbots

From here, you could manually write routines which call the drawsvg library. This is a terrific exercise; head over to the documentation and run through a few examples, and then start building. But using AI tools is also fun! For this we use Playlab, which gives us easy access to state-of-the-art language models like GPT-4 Turbo.

‣

Vector Graphics from GPT-4 Turbo

The Possible Zone