summaryrefslogtreecommitdiff
path: root/script/qr-color.pl
blob: c6653710d20047e725d3179536c8e629f8e5ff94 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
#!/usr/bin/perl 
use utf8;
use strict;
use warnings;
use Text::QRCode;
use GridFiller;
use GridFiller::Result::Pango;
use feature 'say';
use open ':std',':locale';
use Log::Log4perl qw(:easy);
Log::Log4perl->easy_init($INFO);
 
#Log::Log4perl->get_logger('GridFiller')->level($INFO); 
#Log::Log4perl->get_logger('GridFiller::Chooser')->level($DEBUG); 
#Log::Log4perl->get_logger('GridFiller::Status')->level($DEBUG); 
#Log::Log4perl->get_logger('GridFiller::Result')->level($DEBUG); 
 
binmode DATA,':utf8';
 
my $data = do { local $/="\n__WORDS__\n";my $x=<DATA>;chomp $x;$x };
my @words = <DATA>;chomp @words;
 
my $qr=Text::QRCode->new(
    level=>'H',
    mode=>'8-bit',
);
 
my $arr=$qr->plot($data);
 
my $filler=GridFiller->new({
    words=>\@words,
    grid=> $arr,
});
 
my $result = GridFiller::Result::Pango->new({
    source_grid => $filler->grid,
    @ARGV ? (font_description => $ARGV[0]) : () ),
});
 
$filler->result($result);
$filler->status->mode('longest');
$filler->status->length($result->length_closure);
 
$filler->fill();
 
$result->save_png('/tmp/qr.png');
 
say '';
say 'Leftovers:';
say for @{$result->leftover_words};
 
__DATA__
MECARD:N:Ceccarelli,Gianni;TEL:+447564023056;EMAIL:dakkar@thenautilus.net;URL:http://www.thenautilus.net/contacts/;NICKNAME:dakkar;;
__WORDS__
Richard Dawkins
Bruce Schneier
Lois McMaster Bujold
Kage Baker
David Weber
Robert Heinlein
Douglas Adams
Neal Stephenson
Lewis Carrol
Terry Pratchett
Jorge Luis Borges
Olaf Stapledon
Frank Herbert
Alessandro Bergonzoni
Stefano Benni
Jules Verne
Neil Gaiman
H.G. Wells
Isaac Asimov
Arthur C. Clarke
Philip K. Dick
JRR Tolkien
Ed Wood
Tim Burton
Monty Python
Terry Gilliam
Orson Welles
Luc Besson
Peter Greenaway
David Cronenberg
Stanley Kubrick
Joss Whedon
Quentin Tarantino
Pedro Almodóvar
Mel Brooks
宮崎駿
MIYAZAKI Hayao
押井守
OSHII Mamoru
庵野 秀明
ANNO Hideaki
Alan Moore
鬼頭 莫宏
KITOH Mohiro
手塚 治虫
TEZUKA Osamu
ゆうきまさみ
YUKI Masami
浦沢 直樹
URASAWA Naoki
星野 之宣
YUKINOBU Hoshino
安倍 吉俊
yoshitoshi ABe
士郎 正宗
SHIROW Masamune
Amanda Palmer
Marian Call
Jonathan Coulton
The Flaming Lips
The Pillows
Nightwish
Stefano Nosei
Jethro Tull
菅野 よう子
KANNO Yoko
Franco Battiato
Enya
Helloween
Mike Oldfield
Alan Parsons Project
Emerson, Lake & Palmer
Fabrizio De André
川井 憲次
KAWAI Kenji
David Bowie
Girl Genius
Gunnerkrigg Court
Cyrano de Bergerac
Watership Down
RHPS
Thunderbirds
Doctor Who
The Twilight Zone
Blade Runner
Forbidden Planet
Cowboy Bebop
フリクリ
FLCL
Gundam
Macross
ふしぎの海のナディア
The Secret of Blue Water
涼みやはるひの消失
SUZUMIYA Haruhi
Cutey Honey
電脳コイル
Dennou Coil
灰羽連盟
Haibane Renmei
Star Trek
D&D
Go
Shogi
Perl
Firefly
トップをねらえ!
Gunbuster
Sandman
Honor Harrington
日本語
Tiffany Aching
Dune
Snow Crash
HHGTTG
Dirk Gently
Halo Jones
Top 10
Promethea
Blade Runner
The Princess Bride
The Blues Brothers
Groucho Marx
平成狸合戦ぽんぽこ
Pon Poko
となりのトトロ
Totoro
風の谷のナウシカ
Nausicaä
攻殻機動隊
Ghost in the Shell
新世紀エヴァンゲリオン
Evangelion
Powerpuff Girls
Dresden Codak