1
1
Fork 0
portfolio/_site/repos/blabber-comic/index.html
2021-02-02 12:07:19 -06:00

183 lines
5.7 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<!doctype html>
<html>
<head>
<title>Wroten - blabber-comic</title>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link href="https://unpkg.com/tailwindcss@^2/dist/tailwind.min.css" rel="stylesheet">
</head>
<body class="bg-gray-100">
<header>
<nav>
<ul><li>
<a href="/work-history/antharia/">
Web Design &amp; Dev Intern at Antharia
</a>
</li><li>
<a href="/work-history/cyto-communications/">
Interactive Technologies Lead &amp; Web Admin at Cyto Communications
</a>
</li><li>
<a href="/work-history/eyemaginations/">
Senior Web Engineer at Eyemaginations
</a>
</li><li>
<a href="/volunteering/theseed/">
Austin Give Camp - The SEED
</a>
</li><li>
<a href="/repos/json-query-chain/">
json-query-chain
</a>
</li><li>
<a href="/repos/blabber-comic/" aria-current="page">
blabber-comic
</a>
</li><li>
<a href="/volunteering/code2college/">
Code 2 College
</a>
</li><li>
<a href="/repos/svgdir2sprite/">
svgdir2sprite
</a>
</li><li>
<a href="/repos/my_spells/">
my_spells
</a>
</li><li>
<a href="/volunteering/gabriellas-smile-foundation/">
Gabriellas Smile Foundation
</a>
</li><li>
<a href="/work-history/q2/">
Developer III at Q2ebanking
</a>
</li><li>
<a href="/repos/team-cli/">
team-cli
</a>
</li><li>
<a href="/work-history/allovue/">
Software Engineer at Allovue
</a>
</li><li>
<a href="/repos/sortable-recipes/">
sortable-recipes
</a>
</li><li>
<a href="/work-history/skillsengine/">
Lead Full-Stack Software Engineer at SkillsEngine
</a>
</li><li>
<a href="/repos/ember-select-light/">
ember-select-light
</a>
</li></ul>
</nav>
</header>
<main class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
<div class="max-w-3x1 mx-auto mb-5">
<div class="-ml-2 mt-8 flex flex-wrap items-baseline">
<h1 class="ml-8 mt-2 text-lg font-medium text-gray-900">
blabber-comic
</h1>
<p class="ml-2 mt-1 text-sm text-gray-500 truncate">in </p>
</div>
</div>
<div class="bg-white overflow-hidden shadow sm:rounded-lg">
<div class="px-4 py-5 sm:p-6">
<blockquote>
<p>Converts chat logs to comics.</p>
</blockquote>
<!--more-->
<p><a href="https://gitlab.com/gaiety/blabber-comic">Fork on Gitlab</a></p>
<h1>Blabber-Comic</h1>
<p><a href="https://badge.fury.io/js/blabber-comic"><img src="https://badge.fury.io/js/blabber-comic.svg" alt="npm version"></a></p>
<h2>Sample</h2>
<p><img src="https://raw.githubusercontent.com/hergaiety/blabber-comic/master/comic.png" alt="Preview"></p>
<h2>How it works</h2>
<p>Powered by Node and a node-canvas a comic can automatically be generated from a json array of users/text and some characters/backgrounds to be chosen at random.</p>
<h2>How to use it from the CLI</h2>
<h3>Installing</h3>
<p>Note: Your system may need some <a href="https://github.com/Automattic/node-canvas#compiling">compiled dependencies for canvas to work</a>.</p>
<p><code>npm install -g blabber-comic</code></p>
<h3>Using</h3>
<pre><code>$ blabber
$ Who?: Glen
$ Said What?: Test 1
$ Another? (y/n) y
$ Who?: Sarah
$ Said What?: Test 2
$ Another? (y/n) y
$ Who?: Glen
$ Said What?: Test 3
$ Another? (y/n) n
$ Generating Comic...
$ [ Comic Generated @ comics/1.png ]
</code></pre>
<h3>Additional Options</h3>
<pre><code>$ blabber --path ~/Pictures
</code></pre>
<h2>How to use it in other projects</h2>
<h3>Generate base64Data</h3>
<pre><code class="language-javascript">const blabbercomic = require('blabber-comic');
let messages = [] // Array of messages...
blabbercomic(messages).then(response =&gt; {
console.log('Generated comic as base64 data', response);
}).catch(error =&gt; {
throw error;
});
</code></pre>
<h3>Save as file with <code>fs</code></h3>
<p>Example included in project. Clone then run <code>npm run test</code>.</p>
<pre><code class="language-javascript">const blabbercomic = require('blabber-comic');
const fs = require('fs');
let messages = [] // Array of messages...
blabbercomic(messages).then(response =&gt; {
let base64Data = response.replace(/^data:image\/png;base64,/, '');
fs.writeFile('./storage/comics/comic.png', base64Data, 'base64', error =&gt; {
if (error) console.error('Uhoh...', error);
else console.log('Saved file as `comic.png`');
});
}).catch(error =&gt; {
throw error;
});
</code></pre>
<h3>Customizing characters and backgrounds</h3>
<pre><code class="language-javascript">const blabbercomic = require('blabber-comic');
let backgrounds = ['./assets/backgrounds/1.png', './assets/backgrounds/2.png'];
let characters = ['./assets/characters/1.png', './assets/characters/2.png', './assets/characters/3.png']; // Provide at least 3
let comicSize = 500; // in px square
let borderColor ='#CCCCCC';
let font = 'Impact';
let textColor: '#000000';
let messages = [] // Array of messages...
let config = { backgrounds, characters, comicSize, borderColor, font, textColor };
blabbercomic(messages, config);
</code></pre>
<hr>
<h2>Special thanks to:</h2>
<ul>
<li><a href="https://github.com/Automattic/node-canvas">node-canvas</a> by Cairo</li>
<li>avatars by Iulia Ardeleanu from the Noun Project</li>
<li>backgrounds by Olga Libby from Subtle Patterns</li>
</ul>
</div>
</div>
</main>
</body>
</html>