Software

This page lists only the software pages recently written. Bug tracking and repos are in a separate wiki.

2018-03-12 Writing an Editor

I’d like to collect some links to tutorials teaching readers how to write their own editor. These editors will necessarily be small, but perhaps they’ll be easy to adapt to your own taste.

Vip is a vi-style editor in PicoLisp.

Build Your Own Text Editor: “It’s about 1000 lines of C in a single file with no dependencies, and it implements all the basic features you expect in a minimal editor, as well as syntax highlighting and a search feature. This booklet walks you through building the editor in 184 steps.” I was super impressed when I started reading it (but I never finished it).

Tags:

Add Comment

2018-02-08 Use Old Tech to Fight Information Overload

Here I am, using newsboat as my newsreader instead of visiting Feedly or using Reeder on my iOS devices. It’s an application that runs in the terminal. It doesn’t hide empty feeds. It doesn’t sort feeds. It doesn’t group feeds. I imported a gazillion feeds via OPML file and slowly I’m finding that this or that feed is dead, or that I don’t really enjoy reading a feed, and I simply edit my subscriptions and remove the feeds. It’s as if the slight discomfort of using the tool makes me realize that this or that isn’t actually worth the effort.

At the same time, I find that when I use VF-1 to visit Gopher sites, or when I use newsboat to read blog posts, and I do this from my laptop, then I with purpose, when I have some time. I don’t skim articles. I take the time to think about what I have just read. And I can’t just quickly comment or +1 or start what I have read and move on. Should I write a comment, an actual email, or a post on my blog? Again, an action that requires enough effort to give me pause, to evaluate whether what I was about to do is actually worth doing. And I am starting to find that in the past few years I might done things very efficiently that aren’t actually worth doing in the first place.

I think I’ll start reducing my toolset even further. Perhaps I’ll start browsing the web using w3m again.

I’d lover to view images in my terminal instead of opening new windows. I need to look at the solutions proposed in this thread about displaying pictures in a terminal. So many exciting ideas.

And really, most of the time I just use Emacs, a terminal emulator, and a browser. I think I’ll remain an Emacs user until the very end. But everything else is up for grabs.

Right now I am exploring what Gnome has to offer. That’s why I use Tilix as my terminal emulator. It does tiling and I love that.

alias right="tilix --action=session-add-right"
alias down="tilix --action=session-add-down"

Use Ctrl~Tab to switch between sessions. I think this is good enough for me right now.

And I’m using Tilingnome, an extension to the Gnome shell which does window tiling automatically, without me needing to switch to a tiling window manager. For now, this is very slick. I can open new windows without ever thinking about placement and really, I rarely have more than two or three windows open (specially since my terminal emulator and my editor do tiling). I guess the only key combos I might need eventually is sending a window to the other workspace. I’ll look for it when I have a need for it.

Screenshot showing Emacs and Tilix

Tags:

Comments on 2018-02-08 Use Old Tech to Fight Information Overload

Perhaps this is also the reason I’m starting to prefer blogs, Mastodon and Gopherholes over visiting Google+. It’s just a bit less slick, takes a bit more effort, sometimes it requires my laptop at home, and in the end these little barriers move me away from some social media. I guess that’s very similar to how I moved away from Facebook. I simply uninstalled the app and changed the password. Sure, at home, on my laptop, the password is still around. But it isn’t available in the office. It isn’t available on my phone.

– Alex Schroeder 2018-02-08 18:10 UTC


Now that I’m using newsboat to read my news, I’m discovering a lot of dead blogs. As I’m discovering these, and dropping them (using a slightly convoluted keybome: E to edit, / to search, dd to delete, :wq to save), I’m feeling increasingly frustrated and rushed and I’m starting to think that maybe I should just delete most of them. Right now I still treat them like a treasure trove. But maybe I should treat them like the detritus of times gone by and just clean the house (or boat).

– Alex 2018-02-10 11:37 UTC


I defined a custom link for Tilix:

Regex Command
\bgopher://\S+ tilix -a session-add-down -e /home/alex/.local/bin/vf1 "$0"

– Alex 2018-02-11


Now that I can only read news from my laptop, I find that I no longer feel like I should be reading news on my phone. A relief?

– Alex Schroeder 2018-02-13 14:21 UTC


Reading news using newsboat I find that it doesn’t refresh the feeds unless I tell it to. How refreshing! Those feeds don’t just keep on racking up numbers. Once you’ve read a feed it stays read until you decide to hit r and reload it. Just don’t ever hit R and reload all of the feeds if you’re like me. :)

– Alex Schroeder 2018-02-15 09:17


I’m still going by my new motto: make computer use hard again. Specifically, I shall try to do everything I want to do without one of the big browsers. So, it’s either in Emacs, or newsboat, or w3m, or lynx, or VF-1, or IRC (and that means Emacs), or Mastodon (since that happens via IRC and thus within Emacs). Whenever I find myself starting Firefox or one if its friends, I stop myself. 1/2

Can I do the thing without a browser? If I can, do I still want to do it? If that’s too much trouble, I saved myself from wasting time. Good! If I definitely need a browser because of Javascript or whatever, and I realize that this is the reason, I’m feeling the anger rise and that is often enough for me to close the window again. Good! No time wasted. 😤 (← remember: this is the face of triumph according to Unicode)

– Alex Schroeder 2018-02-18 18:00


I second the recommendation by @wrenpile to read The Tyranny of Convenience by Tim Wu about convenience and struggle and how we must realise that making everything convenient robs us of life experience. We run, not because it is easy but because it is hard. We went to the moon, not because it was easy but because it was hard. Let’s recognise that «hobbies» and «passions» are just inconvenient things we like doing anyway.

– Alex Schroeder 2018-02-18 23:04


I was looking at toot and madonctl trying to find a good command line client for Mastodon but now I think I found what I was looking for: tootstream.

– Alex Schroeder 2018-02-19 07:14 UTC


I bought a book about ed for $4.99 called Ed Mastery.

From the introduction:

After receiving rare but tediously ongoing complaints about my use of mixed male and female third-person pronouns in my technology books, I’ve prepared two editions of this book. Any third-person singular pronouns that appear in the standard edition, for normal people, are female.

Those who believe that women don’t belong in tech books are welcome to purchase the special “Manly McManface” edition, where all third-party singular pronouns are masculine. To compensate for this edition’s much smaller market, though, the Manly edition is pricier than the standard edition. That’s basic economics.

From the shop:

Ed Mastery
Suggested Price $4.99

Ed Mastery: Manly McManface Edition
Suggested Price $15.99

– Alex 2018-04-05 23:34 UTC

Add Comment

2017-10-25 fgallery

I’ve been working on fgallery again. My fork currently has the following features:

  • simple update of existing galleries [1][2]
  • support for clients without Javascript [3][4][5]
  • allows you to provide metadata for social media [6][7][8]

There are pull requests for all of these, upstream.

I also merged these features:

  • allow hard-linking of images instead of copying [9]

Tags:

Comments on 2017-10-25 fgallery

Now at Sitelen Mute!

– Alex Schroeder 2018-03-12 08:03 UTC

Add Comment

2017-05-30 Planning for my Summer of Code

Soon, summer break. Sadly, this year begins later than usual. I have to wait until mid July! 😢

This is what I’m contemplating:

  1. work on the Gridmapper Megadungeon Generator.
  2. work on making Gridmapper useful for grid-based wilderness maps, like this map by Edward Kann (it reminds me of Ultima IV and Ultima V)
  3. allow Oddmuse to upload pictures by “pasting” them into the text area like GitHub does it (notes)
  4. maybe resume working on Oddmuse and WebDAV?
  5. also, practice playing the recorder
  6. add more face elements to my digital set for the Face Generator
  7. is Oddmuse ready for Perl 6? Apparently there is no Mojolicious for Perl 6! Installing rakudobrew and zef. I’d probably be using Bailador and HTTP::Easy.
  8. a city map creator like this but colorful, like this
  9. read Piracy by Adrian Johns (see 2015-07-14 No Copyright)
  10. read Against Intellectual Monopoly by Michele Boldrin and David K. Levine (see 2017-06-25 Against Intellectual Monopoly)
  11. allow fgallery to update an existing destination directory
  12. Take a look at the Classic Traveller Character Generator

Tags:

Comments on 2017-05-30 Planning for my Summer of Code

As a note, I’ve done some experiments with perl 6 grammars for parsing wikitext. If done right, it will be possible to merge two grammars into one simply by creating a class with two parents, e.g. markdown+creole (or even markdown + tables :P). Pretty cool stuff.

By the way, I’ll be free from June 13th and onwards, so feel free to ping me about anything.

– AlexDaniel 2017-06-05 15:34 UTC


Yay!!

Also, im thinking we should just rewrite all of Oddmuse and not just port the existing code.

– Alex Schroeder 2017-06-05 19:01 UTC

Add Comment

2016-01-23 Testing Encrypted Mail Setup

I’ve updated my guide, the Gmail Gnus GPG Guide (GGGG) to incorporate the latest addition to the FSF’s Email Self-Defense guide to free software-powered encryption. They even have a guide on how to help your friends and family, including talking points if want to make your case.

Anyway, the thing I added to the guide is how to initiate communication with the bot:

  1. send him your Public key
  2. get his public key from a keyserver
  3. how to set up a keyserver in order to achieve step #2
  4. send him an encrypted mail

Tags:

Comments on 2016-01-23 Testing Encrypted Mail Setup

The public (not private) key should be sent in point 1. Best regards, A.

– A. 2016-01-23 16:01 UTC


Aaaaargh!

– Alex Schroeder 2016-01-23 16:36 UTC


Thanks!

By the way, what’s the reason to use gpg instead of gpg2?

– AlexDaniel 2016-01-23 22:44 UTC


Also, it looks like it has to be ~/.gnus.el instead of ~/.gnus.

– AlexDaniel 2016-01-24 00:07 UTC


Hm, I think ~/.gnus is fine, according to the manual: “… and gnus-init-file (‘~/.gnus’ by default)”

As for the GPG version, I am using gpg. Perhaps on Debian version 2 is only available as gpg2?

alex@Megabombus:~$ gpg --version
gpg (GnuPG) 2.0.29
libgcrypt 1.6.4
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.

Home: ~/.gnupg
Supported algorithms:
Pubkey: RSA, RSA, RSA, ELG, DSA
Cipher: IDEA, 3DES, CAST5, BLOWFISH, AES, AES192, AES256, TWOFISH,
        CAMELLIA128, CAMELLIA192, CAMELLIA256
Hash: MD5, SHA1, RIPEMD160, SHA256, SHA384, SHA512, SHA224
Compression: Uncompressed, ZIP, ZLIB, BZIP2

– Alex Schroeder 2016-01-24 00:15 UTC


Interesting. Also it would be great to know how to make gnus sort things in the right order by default…

– AlexDaniel 2016-01-24 00:35 UTC


Oh well. It seems like the idea is to have only unread messages visible by default. If you keep it this way then there’s no reason to change the order. Hmmmm.

– AlexDaniel 2016-01-24 01:37 UTC


I’m not sure if this approach is really useful. Gmail sorts messages into three tabs – Primary, Social and Promotions. Obviously I never read Social and Promotions, and I even ignore some messages in Primary. That’s the result:

https://files.progarm.org/2016-01-24-033741_154x97_scrot.png

In such case default settings in gnus are so alien. But I thought that it is how all people read their emails? Is there any way to get this PrimarySocialPromotions distinction in gnus?

– AlexDaniel 2016-01-24 01:40 UTC


Not unless Gmail makes the tabs available via IMAP, i.e. via folders (like it does for labels). I don’t think this is happening. Apparently you can search for them but I don’t understand how you would use this from Gnus. [1]

– Alex Schroeder 2016-01-27 20:26 UTC

Add Comment

2015-10-09 Oddmuse and Mojolicious

I’m trying to run Oddmuse within a Perl web framework: Mojolicious using Mojolicious::Plugin::CGI. It won’t be as perfect as a true Mojolicious app, but it will still be much faster than a simple CGI script. When running as a CGI script, every request loads Perl and compiles all the modules – including the CGI module itself – and Oddmuse and the config files. When running under Mojolicious, we no longer load Perl and we compile Oddmuse just once. Oddmuse itself will keep loading the config file and all that, but it’s still much better than before. The Mojolicious app itself is then started by Toadfarm. And in order to force myself to test it, I’ve switched this wiki over to the new setup!

First, tell Apache to act as a reverse proxy and pass all /wiki requests to the new server. The two ProxyPass instructions at the bottom are the important bits:

<VirtualHost *:80>
    ServerName alexschroeder.ch
    ServerAlias www.alexschroeder.ch
    Redirect permanent / https://alexschroeder.ch/
</VirtualHost>
<VirtualHost *:443>
    ServerAdmin alex@alexschroeder.ch
    <Directory />
        Options None
        AllowOverride None
        Order Deny,Allow
        Deny from all
    </Directory>
    ServerName alexschroeder.ch
    ServerAlias www.alexschroeder.ch
    ServerAlias rpg.alexschroeder.ch
    DocumentRoot /home/alex/alexschroeder.ch
    <Directory /home/alex/alexschroeder.ch>
        Options ExecCGI Includes Indexes MultiViews SymLinksIfOwnerMatch
        AddHandler cgi-script .pl
        AllowOverride All
        Order Allow,Deny
        Allow from all
    </Directory>

    SSLEngine on
    SSLCertificateFile      /home/alex/ssl/alexschroeder.crt
    SSLCertificateKeyFile   /home/alex/ssl/alexschroeder.key
    SSLCertificateChainFile /home/alex/ssl/GandiStandardSSLCA2.pem
    SSLVerifyClient None

    ProxyPass /wiki             https://alexschroeder.ch:8080/wiki
    ProxyPass /mojo             https://alexschroeder.ch:8080/mojo

</VirtualHost>

Toadfarm setup in ~/farm/farm:

#!/usr/bin/env perl
use Toadfarm -init;

logging {
  combined => 1,
  file     => "farm.log",
  level    => "info",
};

1. other apps go here...

mount "$farm/alexschroeder.pl" => {
  "Host" => qr{^(www.)?alexschroeder\.ch$},
  mount_point => '/wiki',
};

plugin "Toadfarm::Plugin::AccessLog";

start; # needs to be at the last line

The above means that all requests to htpp://alexschroeder.ch:8080/wiki and htpp://www.alexschroeder.ch:8080/wiki will be handled by Oddmuse.

Mojolicious wrapper in ~/farm/alexschroeder.pl:

#! /usr/bin/env perl

use Mojolicious::Lite;

plugin CGI => {
  support_semicolon_in_query_string => 1,
};

plugin CGI => {
  route => '/',
  script => 'wiki.pl', # ~/farm/wiki.pl
  env => {WikiDataDir => '/home/alex/alexschroeder'},
  errlog => 'alexschroeder.log', # path to where STDERR from cgi script goes
};

app->start;

In this case, wiki.pl is simply the original Oddmuse script, unchanged. :)

Tags:

Comments on 2015-10-09 Oddmuse and Mojolicious

Cool! That’s interesting.

What about side effects? Like, if you forget to initialize some variable somewhere, what is going to happen? (Thinking about mod_perl and all stuff related to it)

Also, I miss one important thing from your report... What about page load time? How much faster is it right now, comparing to regular cgi script?

– AlexDaniel 2015-10-09 11:21 UTC


I did not measure page load time. I also think that it keeps forking to run the script, so globals start empty every time? Not sure about the details. I haven’t seen any side effects, yet. Let me know if you see anything!

– Alex Schroeder 2015-10-09 11:39 UTC


Could you be so kind to measure the load time?

– AlexDaniel 2015-10-09 11:50 UTC


I think I was under the illusion that it was working. Now it is working. Hah! I had to rename my old wrapper script to realize that my ProxyPass instructions had been wrong.

Things to remember:

Check the config file for weird stuff.

1. if ($ENV{SERVER_PORT} == 8080) {
1.   $ScriptName  = 'https://alexschroeder.ch:8080/wiki';
1.   $FullUrl     = 'https://alexschroeder.ch:8080/wiki';
1. }

Make sure the user running toadfarm can write alle the files in your data directory. In my case, the data directory belongs to www-data.alex but there were temp files that alex could not write.

– Alex Schroeder 2015-10-09 13:27 UTC


Hm. Current setup, I get more or less the same time when I look at network analysis with my browser when I’m loading /wiki/About and when I’m loading /wiki2/About with wiki2.pl being my old wiki.pl wrapper script. I get numbers between 200ms and 700ms. I do note that /wiki/About keeps getting me a 200 OK response instead of a 304 NOT MODIFIED. I’m not quite sure what the problem is.

– Alex Schroeder 2015-10-09 13:40 UTC


Oh, and the code shows that our script is being exec’d. I’m not sure about the headers. I think if our script prints HTTP headers, we should be fine.

– Alex Schroeder 2015-10-09 13:47 UTC


Well, at least it seems to work right now. I think I got confused about the various restarts required.

The missing 304 NOT MODIFIED remains a mistery, however. I’ve tried $q = new CGI; $q->nph(1) in the config file, $CGI::NPH = 1 in the config file, CGI::nph(1) in the config file, use CGI qw/-utf8 -nph/ in the core script, and print $q->header(-nph=>1, -status=>'304 NOT MODIFIED') and return if PageFresh(); in the core script, reloading my toadfarm between edits and found no change.

When I tried to export MOJO_PLUGIN_CGI_DEBUG=1 before starting the toadfarm, I got a 503 error when visiting the site.

This is very annoying.

– AlexSchroeder 2015-10-09 14:32 UTC


OK, so the question is: How often is 304 NOT MODIFIED actually used?

alex@kallobombus:~/farm$ sudo wc -l /var/log/apache2/access.log.1
259852 /var/log/apache2/access.log.1
alex@kallobombus:~/farm$ sudo grep ^oddmuse /var/log/apache2/access.log.1 | wc -l
32867
alex@kallobombus:~/farm$ sudo grep "^oddmuse.*GET /wiki.* 304 " /var/log/apache2/access.log.1 | grep -v feed | wc -l
270

Filtering out feed request we’re down to 8‰.

For my own site:

alex@kallobombus:~/farm$ sudo grep ^alexschroeder /var/log/apache2/access.log.1 | wc -l
79286
alex@kallobombus:~/farm$ sudo grep "^alexschroeder.*GET /wiki.* 304 " /var/log/apache2/access.log.1 | grep -v feed | wc -l
702

This reduces the percentage to 9‰.

So, if we redirect feed requests to files and use a cron job to produce some of them, the 304 NOT MODIFIED response seems to be something we can do without, even if I think it ought to work.

– AlexSchroeder 2015-10-09 14:54 UTC


In other words, no noticeable performance boost? Do I read it right? But then why bother?

– AlexDaniel 2015-10-09 21:26 UTC


Hehe, indeed. The point is, however, that I want some sort of plan that will allow me to incrementally develop a solution. Mojolicious::Plugin::CGI does a lot of what I want. It integrates into Mojolicious and thus it can do logging, forking, and so on. It handles input and output. The only thing that’s missing is that it exec’s the script – loading Perl and compiling all the modules on every request.

I think I’ll try and modify the Plugin for my purposes. Then it’ll require Oddmuse once and just run DoWikiRequest on every request, mod_perl style.

– AlexSchroeder 2015-10-10 07:40 UTC


These are the changes I had to make to Mojolicious::Plugin::CGI: Add run option for a code reference and Make sure the status code is actually used and Add HTTP_IF_NONE_MATCH to environment.

This is the new server script I used:

#! /usr/bin/env perl

use lib '/Users/alex/src/mojolicious-plugin-cgi/lib';

use Mojolicious::Lite;

plugin CGI => {
  support_semicolon_in_query_string => 1,
};
 
plugin CGI => {
  route => '/wiki',
  script => 'wiki.pl',
  run => \&OddMuse::DoWikiRequest,
  before => sub {
    $OddMuse::RunCGI = 0;
    $OddMuse::DataDir = '/tmp/oddmuse';
    require 'wiki.pl' unless defined &OddMuse::DoWikiRequest;
  },
  env => {},
  errlog => 'wiki.log', # path to where STDERR from cgi script goes
};

get '/' => sub {
  my $self = shift;
  $self->redirect_to('/wiki');
};
 
app->start;

– AlexSchroeder 2015-10-11 06:51 UTC


With the above setup now installed on alexschroeder.ch, I’m getting response times of 150–230ms when looking at /wiki/About (and a 304 Not Modified response). The old CGI setup under /wiki2/About is giving response times of 250–720ms.

So, much better?

I’ve also started noticing the first signs of trouble: Edit page, save, look at it (looks good), edit page again and notice that it’s showing the old text, not the new text.

– AlexSchroeder 2015-10-11 10:28 UTC


When I tried it with this page, I saw my browser requesting the page using the following:

GET /wiki?action=edit;id=Comments_on_2015-10-09_Oddmuse_and_Mojolicious HTTP/1.1
...
If-None-Match: 1444395217%1e1%1eAlexSchroeder%1ekensanata%40gmail.com

Oddmuse replied with a 304 Not Modified and the content was wrong. As I checked, however, the timestamp of the index file does in fact match:

alex@kallobombus:~/alexschroeder$ date -r pageidx +%s
1444395217

Looking at the log of recent changes, however:

alex@kallobombus:~/alexschroeder$ tail -n 1 rc.log
1444559479Comments_on_2015-10-09_Oddmuse_and_Mojolicious1With the above setup now installed on alexschroeder.ch, I'm getting response times of 150–230ms when looking at wikiAbout (and a 304 Not Modified response). So, much better? 127.0.0.1AlexSchroeder23en

I guess something about TouchIndexFile isn’t working.

sub TouchIndexFile {
  my $ts = time;
  utime $ts, $ts, $IndexFile;
  $LastUpdate = $Now = $ts;
}

I’ve made sure that all the files belong to alex.alex instead of www-data.alex. And that seems to help. After saving:

alex@kallobombus:~/alexschroeder$ date -r pageidx +%s
1444560771
alex@kallobombus:~/alexschroeder$ tail -n 1 rc.log
1444560771Comments_on_2015-10-09_Oddmuse_and_MojoliciousWhen I tried it with this page, I saw my browser requesting the page using the following: {{{ GET wiki?action=edit;id=Commentson2015-10-09OddmuseandMojolicious HTTP1.1 … If-None-Match: 1444395217%1e1%1eAlexSchroeder%1ekensanata%40gmail.com }}} Oddmuse replied with a 304 Not Modified and the content…127.0.0.1AlexSchroeder24en

And the next request:

GET /wiki?action=edit;id=Comments_on_2015-10-09_Oddmuse_and_Mojolicious HTTP/1.1
...
If-None-Match: 1444395217%1e1%1eAlexSchroeder%1ekensanata%40gmail.com

HTTP/1.1 200 OK
...
Etag: 1444560771%1e1%1eAlexSchroeder%1ekensanata%40gmail.com
...

Yay?

– AlexSchroeder 2015-10-11 10:52 UTC


OK, added one final patch to make it work without having to use the -nph option for the CGI library and submitted a pull request. And I installed it for this site as well. “Eat your own dog food,” and all that.

– AlexSchroeder 2015-10-11 12:41 UTC


Wow, many more commits after talking to the maintainer.

– AlexSchroeder 2015-10-11 16:14 UTC

Add Comment

2015-10-06 Pink Bliss

Pink Bliss has improved somewhat. Mostly, I just added some magit faces.

You know you want it! Download from GitHub!

Emacs, in it’s maximized glory:

https://alexschroeder.ch/pics/21940845326_d05aa31cc9_c.jpg

Tags:

Add Comment

2015-10-05 Character Sheet Generator Using New Face Generator

My Character Sheet Generator now uses my Face Generator. The rewrite is done and it’s time to go back to drawing some face elements! Elves!

Tags:

Comments on 2015-10-05 Character Sheet Generator Using New Face Generator

Now drawing: dwarf beards.

– Alex Schroeder 2015-10-07 09:39 UTC

Add Comment

2015-10-02 RPG Web Apps I Have Written

I’m trying to make a list of web apps I have written for role-playing games...

If you like what I’m doing, you can sponsor future web apps via Patreon or just send some money to kensanata@gmail.com using PayPal.

Tags:

Comments on 2015-10-02 RPG Web Apps I Have Written

I think that you forgot to mention Gridmapper.

– AlexDaniel 2015-10-03 16:26 UTC


Oops! Thanks, added.

– Alex Schroeder 2015-10-03 22:16 UTC


And I have finished rewriting the Character Generator as a Mojolicious::Lite application and both the Face Generator are now running as two apps within a Toadfarm, and Toadfarm is beeing monitored by Monit. I think I’m happy now!

– Alex Schroeder 2015-10-05 07:35 UTC

Add Comment

2015-09-28 Better

Everything is better! My Face Generator is progressing nicely. I think the galleries for men and women are already pretty good. The entire app is running on Hypnotoad behind Apache/mod_proxy. It’s fast! And I’m going to support multiple artists. Please help me if you can! I’m not great with faces. I have barely drawn any until this project started. I had to read How to Draw a Face on WikiHow, that’s how bad I was!

Here’s how I’m doing it right now. The basic instructions are on GitHub.

First, print a copy of my empty.pdf. If you need a thinner face, take my elf.pdf. If you need a rounder face, take my dwarf.pdf.

If you printed the default file, this is what it would look like:

https://alexschroeder.ch/pics/21790351671_13a47f2a39_c.jpg
Download the PDF!

Make sure you don’t scale the image to fit the page. Try to use 100% of the image.

Then you draw 25 images of a particular element: hair, eyes, nose, ears, mouth, chin. 10% of all faces also get an extra element. Good for scars. My experience is that you need around 50 components for every element to provide enough variety – two sheets for each element is what I suggest.

Then you scan it. You should get something like the following:

https://alexschroeder.ch/pics/21593038178_06595f84b8_c.jpg

There are more examples on Flickr.

If you have something like the above your work is done. Send the images to me and I will do the rest!

What does the rest involve? You crop it and resize it to 2250×3000 pixels. My scanner is notoriously bad about these proportions.

I have scripts to extract whatever you draw from the helping lines of your scan. I have three variants ready to go:

  1. The standard reduces the image to a few shades of blue: convert -blur 0x1 +dither -remap tintenblau.png scan1.jpg source1.png
  2. This is good if you draw using a pencil and want to keep that pencil look: convert -blur 0x1 +dither -level 30%,80% scan1.jpg source1.png
  3. This is good if you draw using a pencil and want to have it look like it was inked without going through the trouble of inking it yourself: convert -blur 0x1 +dither -level 50%,80% -grayscale rec709luma scan1.jpg source1.png

I think you need to think about speed. Two sheet per element with six elements means 12 sheets. Save yourself the time of inking! Fiddle with the -level argument instead. The first percentage means that every pixels darker than this much is going to end up black. The second percentage means that every pixel lighter than this much is going to end up white. Raise the first number until you’re happy with the darkness of your image. Lower the second number until the helping lines disappear.

You should end up with something like the following:

https://alexschroeder.ch/pics/21521333488_74f104033a_c.jpg

Now’s the time to use my cutter script. It splits the image into 25 images of 450 x 600 pixels each. You must tell it the artist (alex), the element (hair, eyes, nose, ears, mouth, chin, extra) and the type (man, woman, elf, dwarf) you want to save it under: perl helpers/cutter.pl source1.png alex eyes_all.

Eventually, you’ll end up with a large number of files.

And that’s it! I commit it to my repository on GitHub and deploy it on my server.

If you’re running the web application, there’s even the possibility to debug faces.

I’m going to link to the debug interface so that you can take a look – but in the end, you won’t be able to save any changes unless you’re the artist of one the collections.

  1. Choose an element to debug
  2. List all the components for this element (in this case, eyes)
  3. Edit one component (in this case, eyes_all_59.png)
  4. When you click any of the zones, you should get an error… :)

Tags:

Comments on 2015-09-28 Better

Airi Ayame has been adding manga style face elements. Thank you!! :)

Not yet complete, but already recognizable: → Women's gallery by Airi!

– Alex Schroeder 2015-09-28 12:30 UTC


So, if I want to get digital, a single pic with 450*600 pixels, maybe even with a blue palette would be great. I just found a book on my harddrive with some art from early 19th century - So no scanning but copying and pasting... I was worried that it is a little different stylewise, but, hey Manga... :-)

rorschachhamster 2015-09-28 15:56 UTC


I’ve drawn face elements for elves and dwarves and noticed that having a different head shape was essential for me. That’s why the repository now contains elf.pdf and dwarf.pdf.

Another thing I noticed was that having opaque elements is tricky. This is most relevant if you plan on having white or blond hair cover parts of the face. As you’ll be using a lot of white filling, and since white is considered to be transparent, the face will will shine through your hair.

In order to handle this, I have seen two solutions. Perhaps there are more?

  1. Don’t do it – anything that hangs “in front” of the face needs to be inked. This is what I do.
  2. Use some other color to fill areas that should be opaque and white. Use #FFFFFF for the transparent background and use #FEFEFF for the white-looking opaque foreground. This usually involves flood-filling those areas in Gimp or Photoashop and therefore requires well defined, enclosed areas. This is not always easy to achieve and takes a lot of time.
  3. Use colors. I haven’t seen this in actual use but it should work. If you need something light and opaque, use a light color as you draw. A very light blue, or beige, or grey. Just make sure it’s different from the white background and make sure it’s not interspersed whith white pixels. Using a light pencil might leave too many white pixels, for example.
  • - AlexSchroeder 2015-10-07 21:15 UTC

Add Comment

More...

Comments


Please make sure you contribute only your own work, or work licensed under the GNU Free Documentation License. Note: in order to facilitate peer review and fight vandalism, we will store your IP number for a number of days. See Privacy Policy for more information. See Info for text formatting rules. You can edit the comment page if you need to fix typos. You can subscribe to new comments by email without leaving a comment.

To save this page you must answer this question:

Please say HELLO.