Archive for November, 2010

Nov 02 2010

ComicBake hits version 0.1 and becomes almost usable!

Published by Dougal under Programming

It’s been such a long time since I looked at this stuff that I almost needed reminding what it was all about myself. So I’ll explain things more or less from the start.

The basic principle is that ComicBake can turn “scripts”, which resemble scripts as written by playwrights or screenwriters, and turn them into comic strips. This is the kind of output it produces (excuse the less-than-stellar dialogue) — speech bubbles tied to users, margins around the perimeter and multiple panels stitched together.

generated web comic

This is the script which defined the above image:

-- An Insult
-- A Series of Examples
-- 05 September 2009
-- Dougal Stanton
 
-- Photo CC-licenced from:
-- http://www.flickr.com/photos/clairity/154640125/
 
Scene 1. <scenes/conversation.png>
 
Man: This is going to be some one-sided
     chat as a demonstration of that
     kind of comic.
 
Scene 2.
 
Man: One character will have loads of
     stuff to say while the other will
     remain unnaturally silent for an
     extremely long time...
 
Scene 3.
 
Man: ...until finally, they leap out
     and attack with something both
     insightful and witty.
 
Woman: Yer maw.

The data which ties these two together is a “map” file for each background image. The script points to scenes/conversation.png so there’s also a conversation.map which has sets of co-ordinates for two entities called “man” and “woman”.

The magic incantation to pull all this together is:

$ comicbake --input scriptfile

Standard behaviour will produce comicstrip.png and comicstrip.N.png for panels 1 to N. (The individual panels are stitched together after they are written to disk.) You can choose different output names, and put the temporary panel files in a separate location:

$ comicbake --input scriptfile --tmpdir tmp/ --output mycomic

Full help available by running comicbake --help.

Things to note at the moment.

  • Obviously the speech placement isn’t perfect: the “punchline” should be further down the page so the reading order isn’t confused. Right now I’m just using the centre points of each rectangle, where really I should be ensuring that the top of the next bubble is below the bottom of the last bubble. All in good time!
  • I could probably serve to shrink the text or maybe the bubble margins a bit. In the second panel the man is nearly being decapitated by his own speech. Similarly, if there’s plenty of room it wouldn’t help to spread the bubbles out a bit. It’s hard to program this stuff without many examples at once: each change improves one comic but ruins another.
  • The preamble is parsed (title, author, etc.) but nothing is done with it yet. In future I want to place this information on the image (maybe in the margin at the bottom).
  • The text layout of each speech is drawn directly from how it’s written in the script. This makes it easier to adjust if you want to, but if you don’t really care then you still have to think about it. That being said, positioning of line breaks is pretty important with so small an amount of text. It would be foolish to remove that for greater simplicity.
  • I read somewhere that the library I’m using for text output respects inline HTML tags for styling. I haven’t played with that yet so it may not work. More importantly it may screw things up. Something to experiment with.
  • I’ve been experimenting with thought bubbles (you know, the clouds with trailing smaller clouds) but haven’t decided how to treat that in text. What would be the best way of choosing a thought bubble over a speech bubble? Would this be awkward?

    Garfield: (Thinking) I hate Mondays

    Would I want something less obtrusive?

  • For lack of a better system I’ve riddled the code with TODO and guesswork comments. These show where a shortcut was taken or where a design decision was made without empirical evidence. My hope is to go back and rectify some of those issues.

As always the code is publically available and I’m happy to take patches, suggestions, ideas and links to pictures of cats. The repository does have a README file which is sadly not as accurate or helpful as it could be. My next proper step should probably be documentation so others can use the program and understand the code.

5 responses so far

« Prev