NaNoGenMo / 2017

National Novel Generation Month, 2017 edition.
https://nanogenmo.github.io
186 stars 7 forks source link

Some kind of comic book #54

Open enkiv2 opened 7 years ago

enkiv2 commented 7 years ago

Since it's been a day since NaNoGenMo started & I've already done three, I feel pretty confident about doing something more involved.

Back in 2014, Generative Detective (https://github.com/dariusk/NaNoGenMo-2014/issues/70) showed that comics were possible (and that people are a little more forgiving of what looks like a moody experimental comic than they might be of a novel).

Earlier this summer, I worked on a bot that does a substantial amount of the same kind of processing that Generative Detective needed to do, and in the process demonstrated that the juxtaposition of text and image was often striking even when the image was completely random, so long as both the text and the image were striking on their own: https://github.com/enkiv2/misc/blob/master/barbara_holzer.py

So, I plan to take advantage of my phrase-chain code (https://github.com/enkiv2/misc/tree/master/phrasechain) to generate sentences of text from some input, then superimpose that text on paneled pages, where the panels are random images that I downloaded modified to look like line drawings.

Much as modern comics often don't limit the text to within a panel, I also won't bother: I figure alignment by itself will do enough, for short phrases. I'll select some input corpus that's heavy on short sentences. (I've got some noir around, and some vonnegut.)

Figuring out how to do panel layout with arbitrary images will be the big challenge. I'm thinking I'll start by aligning along the top or left edge, depending upon the panel's aspect ratio in comparison to that of the page, then do the same with the leftover space recursively until less than 1/4th of the page's space is empty, scaling images down so that they fit and adding a border.

Another possible stylistic flourish (which is pretty common in manga): have the first few pages be in color (ex., by posterizing the existing full-color images to four colors) and the rest be in black and white.

PIL has edge detection, so I think that (like Generated Detective) I'll apply that edge detection to the original image and either overlay or replace the image with it.

enkiv2 commented 7 years ago

First step is a filter that makes photos and other images look like sketches: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/sketchify.py

If colorize is set to False, you get a greyscale shaded version (like soft pencils were used to shade an ink sketch). If it's set to True, you get something that looks like watercolor has been used to color in an ink sketch. If you set sketchOnly to true, you drop all the shading.

enkiv2 commented 7 years ago

Image comparisons: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/denpa-onna-to-seishun-otoko-comparison.png https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/PrinceofDarkness-comparison.png

enkiv2 commented 7 years ago

Now I have some panel layout logic: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/panel_layout.py

Basically, I align to a bounding box on the top-left, resize (keeping aspect ratio) to fit inside, and if the image is within two border-widths or 20% of filling on some dimension then I zoom-and-crop to fit along that dimension. If not, I take the leftover boxes (one if we only don't fit along one dimension, and three if we don't fit along both X and Y) and pass them back into the algorithm to be filled.

The images are "panelified" -- i.e., sketchified and given a gutter around them -- before being put on the page.

Example layout: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/panel-layout-test.png

enkiv2 commented 7 years ago

Completed 101-page comic: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/comic.pdf

enkiv2 commented 7 years ago

Reader review: "It feels like someone injected laundry detergent into my eyes and forced me to scroll through Google Image Search"

ghost commented 7 years ago

I flicked through the comic, and I have to say selection of images and filters makes it rather spooky and unsettling at times, good job.

kamn commented 7 years ago

Very cool! I think images could go a long way in making something more 'readable'.

enkiv2 commented 7 years ago

Generative Detective, from a couple years ago, was a lot more choosy about both text & images in ways that almost required a human in the loop. But, I think this is evidence that you can get pretty close with totally random images and juxtapositions, with the right source text.

I didn't really use an appropriate source text, though -- I should have cleaned it up and removed copyright notices and such. Shorter, pre-vetted lines, even in totally random order, make for more striking juxtapositions: https://github.com/enkiv2/misc/blob/master/nanogenmo-2017/holzercomic.pdf

I might try again with Vonnegut source text & one sentence per line. I expected Raymond Chandler to write a lot of short sentences, but the average length is a lot longer than I expected here.

On Thu, Nov 2, 2017 at 11:48 PM Samuel Miller notifications@github.com wrote:

Very cool! I think images could go a long way in making something more 'readable'.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/NaNoGenMo/2017/issues/54#issuecomment-341617255, or mute the thread https://github.com/notifications/unsubscribe-auth/AAd6GTvWvXyLQzVci90CYxtqDUho6cMrks5syoz8gaJpZM4QOQv1 .

enkiv2 commented 6 years ago

I wrote up an extensive post-mortem on this project here: https://medium.com/@enkiv2/fiction-generator-post-mortem-comic-book-generation-9df847dd4ada