Comics Builder in GNU Emacs

 

Generate comics strip from a script in GNU Emacs.

First, create a folder containing artwork. You can use samples from [2]. It should have three subfolders - faces, poses and backgrounds. Images can be GIF, JPG or PNG. Filenames for face and poses follow a convention: <id>-<emotion>.<ext>. Please ensure you have atleast one file for neutral emotion.

Set appropriate values for following variables:

  • comics-artwork - Folder containing artwork
  • comics-col-max - Maximum no. of columns (default: 2)
  • comics-emotions - Alist of emotions and words used to describe them
  • comics-avatars - A list of cons cells (FACE-ID . BODY-ID)

Open a file containing the script (sample below) and run M-x comics. This will generate an SVG image for the comics strip which will fit the display window. Panels are rendered with fixed font-size so that it is always readable.

Actors are assigned an avatar from comics-avatars sequentially as they appear in the script. Normally, all the actors are drawn using neutral emotion. If you want to use a specific artwork for an actor in a panel or generic positive/negative emotions, define the same at the end of the dialog as (<face-emotion>/<body-emotion>).

Background image is defined within square-brackets .e.g. [001]

 

Sample script

[park1]
A statement is rendered as a Narration balloon
a: Hi
b: Hello

A blank line starts a new panel.
b: I'm happy! (positive)
a: I'm sad! (negative)


 

Code

https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/image.el (image-mime-type)
https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/dom.el (dom-tag)
https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/svg.el
https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/comics.el
 

References

 

Comments

  1. Could you create a video explaining how to make it work for dummies? Thanks!

    ReplyDelete
    Replies
    1. I get "Wrong type argument: listp, "A statement is rendered as a Narration balloon"

      Delete
    2. I guess you'd need dom.el from my repo too. The new definition allows string to be identified as a text node.

      https://gitlab.com/atamariya/emacs/-/blob/dev/lisp/dom.el

      Thanks for reporting.

      Delete
    3. Thank you! I also commented on Reddit, I still got an extra error posted there. Thanks for your help.

      Delete
    4. Ah...I didn't see a follow-up on the reddit post. So I assumed it was fixed. What's the new error?

      Delete
    5. Now I get the following error: "Attempt to shape unibyte text".
      Debugger: https://justpaste.it/8iy2s

      Delete
    6. You can either apply following patch or upgrade to latest Emacs https://git.savannah.gnu.org/cgit/emacs.git/commit/?id=fe903c5ab7354b97f80ecf1b01ca3ff1027be446

      Delete
    7. Thanks. I have Emacs 27.2 How do I go about applying that patch? I'm not Emacs savvy.

      Delete
    8. Patching would mean building from sources since it is C code. I guess upgrading to latest version would be a simpler option.

      Delete
    9. Thanks. Will this affect my current distribution (Prelude) or anything in my Emacs if I upgrade?

      Delete

Post a Comment

Popular posts from this blog

GNU Emacs as a Comic Book Reader

Tinylisp and Multi-threaded Emacs

Data Visualization with GNU Emacs