Skip to content

Commit

Permalink
Notebook for blog post exports
Browse files Browse the repository at this point in the history
  • Loading branch information
v4nn4 committed Apr 26, 2024
1 parent 9eac179 commit 62901ed
Show file tree
Hide file tree
Showing 3 changed files with 322 additions and 12 deletions.
315 changes: 315 additions & 0 deletions BlogPost.ipynb

Large diffs are not rendered by default.

18 changes: 7 additions & 11 deletions Demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
},
{
"cell_type": "code",
"execution_count": 10,
"execution_count": 60,
"metadata": {},
"outputs": [],
"source": [
Expand All @@ -29,7 +29,7 @@
"from glyphs_generator.build import initialize_generator_parameters\n",
"from glyphs_generator.data import Point, Stroke\n",
"from glyphs_generator.generate import GlyphGenerator\n",
"from glyphs_generator.rasterize import rasterize_all\n",
"from glyphs_generator.rasterize import rasterize_all, rasterize\n",
"\n",
"anchor_points = [\n",
" Point(-1, -1),\n",
Expand All @@ -43,14 +43,12 @@
" Point(0, -1),\n",
"]\n",
"parameters = initialize_generator_parameters(anchor_points)\n",
"#with open(\"parameters_9ap.json\", \"w\") as f:\n",
"# f.write(parameters.model_dump_json())\n",
"generator = GlyphGenerator(parameters)"
]
},
{
"cell_type": "code",
"execution_count": 11,
"execution_count": 61,
"metadata": {},
"outputs": [
{
Expand All @@ -75,17 +73,15 @@
"]\n",
"seed = strokes[0]\n",
"glyphs = generator.generate(strokes, seed)\n",
"#print(glyphs[4])\n",
"#print(glyphs[6])\n",
"\n",
"tensor = rasterize_all(glyphs, glyph_size=25, margin=10, sort=True) \n",
"tensor = rasterize_all(glyphs, glyph_size=25, margin=10, sort=True)\n",
"plt.imshow(255 - 255 * tensor, cmap=\"gray\")\n",
"plt.axis(\"off\");"
]
},
{
"cell_type": "code",
"execution_count": 12,
"execution_count": 3,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -118,7 +114,7 @@
},
{
"cell_type": "code",
"execution_count": 13,
"execution_count": 4,
"metadata": {},
"outputs": [
{
Expand Down Expand Up @@ -151,7 +147,7 @@
},
{
"cell_type": "code",
"execution_count": 14,
"execution_count": 5,
"metadata": {},
"outputs": [
{
Expand Down
1 change: 0 additions & 1 deletion glyphs_generator/build.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from typing import List, Tuple

from .data import Point, Stroke, GeneratorParameters
from .generate import GlyphGenerator
from .intersect import do_intersect


Expand Down

0 comments on commit 62901ed

Please sign in to comment.