Peter Blair

Create neat images of your source code

Example perl to png file

Example perl to png file

Kinda fringe, maybe lame, but one of the things that I’ve been wanting to do is create thumbnails of certain pieces of code for wiki pages, etc.

I haven’t found any light weight approaches that can be done completely from the command line, but I have found a nice enough approach.
Step 1: Export from VIM
In vim, type:
:TOhtml

And save the resultant file somewhere. Go in, and swap the text and background hex values (it defaults to black text and white background).

Step 2: View html in firefox
Use the plugin screengrab to export the window to a png

Step 3: Reduce the size of the image
You may not want the entire image to be readable, but just want it for effect.


Categorised as: Computers, Programming


One Comment

  1. [...] This post was mentioned on Twitter by FOSSwiki. FOSSwiki said: Create code thumbnails using opensource http://bit.ly/21id6s #nerd #code #opensource http://bit.ly/YrHEo [...]

Get Adobe Flash playerPlugin by wpburn.com wordpress themes