originals 1.0.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Manifest.txt +1 -0
- data/README.md +162 -8
- data/Rakefile +2 -0
- data/lib/originals/service.rb +82 -0
- data/lib/originals/tool.rb +76 -8
- data/lib/originals/version.rb +2 -2
- data/lib/originals.rb +79 -93
- metadata +31 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d1a2765662355854400518a01705d171657ef0d24cc91cfbd6ed4f5371ec8cc
|
4
|
+
data.tar.gz: 2e571418222765c3457d9111f1558b4ee9978d4943e4c40ae26c6e3930f6d083
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a45cd8b280992e23720cfe3ef2a2c80d34eca5feccf1cfd74013ee7ce900953b1430b7768e280a45d360a2418454fc6e61952391ed72fe5cfc34061ba50e89c
|
7
|
+
data.tar.gz: af658e772a8a2881fab06aa28c33c3b31a2cbedb4e326181d4f8bd140b8f0cda56b9b0b01d689715739275c110a9eb9ed8c110b5341abdb068df9f73e1251c58
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -23,22 +23,27 @@ $ fab -h
|
|
23
23
|
resulting in:
|
24
24
|
|
25
25
|
```
|
26
|
-
Usage: fab [options] name [attribute
|
26
|
+
Usage: fab [options] name [attribute attribute ...]
|
27
|
+
fab [options] name id
|
27
28
|
-z, --zoom NUM Zoom factor x2, x4, x8, etc. (default: 1)
|
28
29
|
-b, --background, --bg STRING Background (default: transparent)
|
29
30
|
-i, --id NUM Unique identifier (default: none)
|
31
|
+
-n, --name STRING Base name (default: punk|phunk|marilyn|etc.)
|
30
32
|
|
31
33
|
-h, --help Prints this help
|
32
34
|
```
|
33
35
|
|
34
36
|
|
35
37
|
|
36
|
-
### Punks (24x24)
|
38
|
+
### Punks, Phunks, Philips, Marilyns & More (24x24)
|
37
39
|
|
38
|
-
|
40
|
+
_A free (pixel) art service brought to you by the [punks, (phunks, philips, marilyns, & more) generation library / gem »](https://github.com/cryptopunksnotdead/cryptopunks/tree/master/cryptopunks)_
|
39
41
|
|
40
42
|
|
41
|
-
|
43
|
+
|
44
|
+
#### Punks (24x24)
|
45
|
+
|
46
|
+
Fab(ricate) some (right-looking) punk character pixel art originals from text attributes (from scratch / zero) via built-in spritesheet. Let's try:
|
42
47
|
|
43
48
|
```
|
44
49
|
$ fab punk alien headband
|
@@ -110,7 +115,7 @@ resulting in:
|
|
110
115
|
|
111
116
|
|
112
117
|
|
113
|
-
|
118
|
+
#### Phunks (24x24)
|
114
119
|
|
115
120
|
Let's try some left-looking punks also known as Phunks - "hand-phlipped" by Philip the Intern
|
116
121
|
|
@@ -128,7 +133,7 @@ resulting in:
|
|
128
133
|
|
129
134
|
|
130
135
|
|
131
|
-
|
136
|
+
#### Philips (24x24)
|
132
137
|
|
133
138
|
Let's try some left-looking philips (pre-configured phunk
|
134
139
|
with the built-in attributes: Male 3):
|
@@ -150,7 +155,7 @@ resulting in:
|
|
150
155
|
|
151
156
|
|
152
157
|
|
153
|
-
|
158
|
+
#### Marilyns (24x24)
|
154
159
|
|
155
160
|
Let's try some left-looking marilyns (pre-configured phunk
|
156
161
|
with the built-in attributes: Female 3, Wild Blonde, Mole, Blue Eye Shadow):
|
@@ -190,8 +195,11 @@ resulting in:
|
|
190
195
|
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn2.4@4x.png)
|
191
196
|
|
192
197
|
|
198
|
+
|
193
199
|
### Shiba Inu Doge (24x24)
|
194
200
|
|
201
|
+
_A free (pixel) art service brought to you by the [shiba-inus generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/shibainus)_
|
202
|
+
|
195
203
|
|
196
204
|
Let's try some shiba inu doge - much wow:
|
197
205
|
|
@@ -230,6 +238,8 @@ resulting in:
|
|
230
238
|
|
231
239
|
### Coolcats (24x24)
|
232
240
|
|
241
|
+
_A free (pixel) art service brought to you by the [coolcats generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/coolcats)_
|
242
|
+
|
233
243
|
|
234
244
|
Let's try some coolcats:
|
235
245
|
|
@@ -271,6 +281,8 @@ resulting in:
|
|
271
281
|
|
272
282
|
### Nouns (32x32)
|
273
283
|
|
284
|
+
_A free (pixel) art service brought to you by the [nouns generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/nouns)_
|
285
|
+
|
274
286
|
|
275
287
|
Let's try some noun (pixel avatars):
|
276
288
|
|
@@ -321,6 +333,9 @@ resulting in:
|
|
321
333
|
|
322
334
|
### Moonbirds / Owls (42x42)
|
323
335
|
|
336
|
+
_A free (pixel) art service brought to you by the [moonbirds (& owls)generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/moonbirds)_
|
337
|
+
|
338
|
+
|
324
339
|
|
325
340
|
Let's try some super-rare never-before-seen moonbirds / owls:
|
326
341
|
|
@@ -360,12 +375,151 @@ resulting in:
|
|
360
375
|
|
361
376
|
|
362
377
|
|
363
|
-
|
364
378
|
And so on. Stay tuned for more original artwork series!
|
365
379
|
|
366
380
|
|
367
381
|
|
368
382
|
|
383
|
+
### Bonus: Readymades - Start w/ (Pixel) Art From (Online) Collections
|
384
|
+
|
385
|
+
_A free readymade (pixel) art service brought to you by the [artbase (server edition) »](https://github.com/pixelartexchange/artbase.server)_
|
386
|
+
|
387
|
+
|
388
|
+
Yes, you can. Pick any readymade pixel art (by number e.g. no.1, no.4, no.5, etc.) from any of the many collections served-up by an artbase (server edition)
|
389
|
+
installation.
|
390
|
+
By default "out-of-the-box" the artbase web server / service installation running online
|
391
|
+
at [pixelartexchange.herokuapp.com](https://pixelartexchange.herokuapp.com/) gets called via HTTP.
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
#### More Punks (24x24)
|
396
|
+
|
397
|
+
Let's try some more punks:
|
398
|
+
|
399
|
+
```
|
400
|
+
$ fab morepunk no.179
|
401
|
+
$ fab morepunk no.180
|
402
|
+
$ fab morepunk no.190
|
403
|
+
```
|
404
|
+
|
405
|
+
resulting in:
|
406
|
+
|
407
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk179.png)
|
408
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk180.png)
|
409
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk190.png)
|
410
|
+
|
411
|
+
4x (using the `--zoom=4`/`-z4` option)
|
412
|
+
|
413
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk179@4x.png)
|
414
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk180@4x.png)
|
415
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/morepunk190@4x.png)
|
416
|
+
|
417
|
+
|
418
|
+
|
419
|
+
#### Punk Rocks (24x24)
|
420
|
+
|
421
|
+
Let's try some punk rocks:
|
422
|
+
|
423
|
+
```
|
424
|
+
$ fab punkrock no.1
|
425
|
+
$ fab punkrock no.4
|
426
|
+
$ fab punkrock no.5
|
427
|
+
```
|
428
|
+
|
429
|
+
resulting in:
|
430
|
+
|
431
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock1.png)
|
432
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock4.png)
|
433
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock5.png)
|
434
|
+
|
435
|
+
4x (using the `--zoom=4`/`-z4` option)
|
436
|
+
|
437
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock1@4x.png)
|
438
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock4@4x.png)
|
439
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/punkrock5@4x.png)
|
440
|
+
|
441
|
+
|
442
|
+
|
443
|
+
#### Dooggies (32x32)
|
444
|
+
|
445
|
+
Let's try some dooggies:
|
446
|
+
|
447
|
+
```
|
448
|
+
$ fab dooggie no.0
|
449
|
+
$ fab dooggie no.571
|
450
|
+
$ fab dooggie no.7411
|
451
|
+
```
|
452
|
+
|
453
|
+
resulting in:
|
454
|
+
|
455
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie0.png)
|
456
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie571.png)
|
457
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie7411.png)
|
458
|
+
|
459
|
+
4x (using the `--zoom=4`/`-z4` option)
|
460
|
+
|
461
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie0@4x.png)
|
462
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie571@4x.png)
|
463
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/dooggie7411@4x.png)
|
464
|
+
|
465
|
+
|
466
|
+
|
467
|
+
And so on.
|
468
|
+
|
469
|
+
|
470
|
+
|
471
|
+
|
472
|
+
### Appendix: More Tips & Tricks
|
473
|
+
|
474
|
+
#### Built-In Background Patterns & Images
|
475
|
+
|
476
|
+
Yes, you can use built-in background patterns & images -
|
477
|
+
classics include
|
478
|
+
Ukraine ![](i/background-ukraine-24x24.png),
|
479
|
+
Pride / Rainbow ![](i/background-rainbow-24x24.png).
|
480
|
+
For more see the
|
481
|
+
[backgrounds generation library / gem »](https://github.com/pixelartexchange/pixelart/tree/master/backgrounds)
|
482
|
+
|
483
|
+
|
484
|
+
|
485
|
+
#### Multiple "Stacked" Backgrounds
|
486
|
+
|
487
|
+
Yes, you can use multiple backgrounds and stack one background onto another. (Note: This only works for "semi-transparent" backgrounds such as
|
488
|
+
Rainbow 1 ![](i/background-rainbow1-24x24.png),
|
489
|
+
Rainbow 2 ![](i/background-rainbow1-24x24.png), etc.) Example:
|
490
|
+
|
491
|
+
|
492
|
+
```
|
493
|
+
$ fab marilyn flowers earring smile --background=0x638596+rainbow1
|
494
|
+
$ fab marilyn flowers earring smile --background=matrix1+rainbow2
|
495
|
+
$ fab marilyn flowers earring smile --background=ukraine+rainbow2
|
496
|
+
|
497
|
+
$ fab phunk no.1 --background=0x638596+rainbow1
|
498
|
+
$ fab phunk no.1 --background=matrix1+rainbow2
|
499
|
+
$ fab phunk no.1 --background=ukraine+rainbow2
|
500
|
+
```
|
501
|
+
|
502
|
+
resulting in:
|
503
|
+
|
504
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3a.png)
|
505
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3b.png)
|
506
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3c.png),
|
507
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1a.png)
|
508
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1b.png)
|
509
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1c.png)
|
510
|
+
|
511
|
+
|
512
|
+
4x (using the `--zoom=4`/`-z4` option)
|
513
|
+
|
514
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3a@4x.png)
|
515
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3b@4x.png)
|
516
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/marilyn3c@4x.png),
|
517
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1a@4x.png)
|
518
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1b@4x.png)
|
519
|
+
![](https://github.com/pixelartexchange/originals/raw/master/i/phunk1c@4x.png)
|
520
|
+
|
521
|
+
|
522
|
+
|
369
523
|
## Install
|
370
524
|
|
371
525
|
Just install the gem:
|
data/Rakefile
CHANGED
@@ -26,11 +26,13 @@ Hoe.spec 'originals' do
|
|
26
26
|
self.history_file = 'CHANGELOG.md'
|
27
27
|
|
28
28
|
self.extra_deps = [
|
29
|
+
['backgrounds'],
|
29
30
|
['cryptopunks'],
|
30
31
|
['shibainus'],
|
31
32
|
['moonbirds'],
|
32
33
|
['coolcats'],
|
33
34
|
['nouns'],
|
35
|
+
['webclient'],
|
34
36
|
]
|
35
37
|
|
36
38
|
self.licenses = ['Public Domain']
|
@@ -0,0 +1,82 @@
|
|
1
|
+
|
2
|
+
## get image via artbase (HTTP) web service
|
3
|
+
|
4
|
+
|
5
|
+
## forward define superclass for image
|
6
|
+
module Artbase
|
7
|
+
class Image < Pixelart::Image; end
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
|
12
|
+
module Artbase
|
13
|
+
################
|
14
|
+
# convenience helpers / shortcuts
|
15
|
+
def self.service ## "shared" single (default) instance
|
16
|
+
@service ||= Service.new
|
17
|
+
end
|
18
|
+
|
19
|
+
class Image
|
20
|
+
def self.get( name, id ) Artbase.service.get( name, id ); end
|
21
|
+
end # class Image
|
22
|
+
|
23
|
+
|
24
|
+
## todo/fix: move name variants into artbase server itelf - why? why not?
|
25
|
+
COLLECTIONS = {
|
26
|
+
'punk' => 'punks',
|
27
|
+
'morepunk' => 'morepunks',
|
28
|
+
'readymadepunk' => 'readymadepunks',
|
29
|
+
'bwpunk' => 'bwpunks',
|
30
|
+
'frontpunk' => 'frontpunks',
|
31
|
+
'intlpunk' => 'intlpunks',
|
32
|
+
'boredape' => 'boredapes',
|
33
|
+
'ape' => 'apes',
|
34
|
+
'basicboredape' => 'basicboredapes',
|
35
|
+
'coolcat' => 'coolcats',
|
36
|
+
'dooggie' => 'dooggies',
|
37
|
+
'mooncat' => 'mooncatrescue',
|
38
|
+
'moonbear' => 'moonbears',
|
39
|
+
'moonbird' => 'moonbirds',
|
40
|
+
'starbird' => 'starbirds',
|
41
|
+
'moonbirdpunk' => 'moonbirdpunks',
|
42
|
+
'8bit' => '8bits',
|
43
|
+
'gopher' => 'gophers',
|
44
|
+
'rock' => 'rocks',
|
45
|
+
'punkrock' => 'punkrocks',
|
46
|
+
}
|
47
|
+
|
48
|
+
|
49
|
+
###################
|
50
|
+
# main artbase service handler / machinery
|
51
|
+
class Service
|
52
|
+
DEFAULT_BASE_URL = 'https://pixelartexchange.herokuapp.com'
|
53
|
+
|
54
|
+
|
55
|
+
def initialize( base_url=DEFAULT_BASE_URL )
|
56
|
+
@base_url = base_url
|
57
|
+
end
|
58
|
+
|
59
|
+
def get( collection, id )
|
60
|
+
|
61
|
+
url = "#{@base_url}/#{collection}/#{id}.png"
|
62
|
+
res = Webclient.get( url )
|
63
|
+
|
64
|
+
puts "#{res.status.code} #{res.status.message}"
|
65
|
+
puts " content_type: #{res.content_type}"
|
66
|
+
puts " content_length: #{res.content_length} bytes (#{res.content_length.class.name})"
|
67
|
+
|
68
|
+
if res.status.ok?
|
69
|
+
## todo/fix: move to Pixelart::Image itself
|
70
|
+
## use from_blob or such - why? why not
|
71
|
+
img_inner = ChunkyPNG::Image.from_blob( res.blob )
|
72
|
+
img = Artbase::Image.new( img_inner.width, img_inner.height, img_inner )
|
73
|
+
img
|
74
|
+
else
|
75
|
+
puts "!! HTTP ERROR - image data request failed; sorry"
|
76
|
+
return nil
|
77
|
+
end
|
78
|
+
end
|
79
|
+
end # class Service
|
80
|
+
|
81
|
+
end # module Artbase
|
82
|
+
|
data/lib/originals/tool.rb
CHANGED
@@ -1,6 +1,9 @@
|
|
1
1
|
module Originals
|
2
2
|
class Tool
|
3
3
|
|
4
|
+
|
5
|
+
|
6
|
+
|
4
7
|
def self.main( args=ARGV )
|
5
8
|
puts "==> welcome to the fab(ricate) tool with args:"
|
6
9
|
pp args
|
@@ -50,20 +53,85 @@ class Tool
|
|
50
53
|
name = args[0] ## todo/check - use collection_name/slug or such?
|
51
54
|
attributes = args[1..-1]
|
52
55
|
|
56
|
+
|
53
57
|
## normalize name of series
|
54
58
|
## e.g. Shiba Inu => shibainu etc.
|
55
|
-
key =
|
59
|
+
key = Originals.factory._norm_name( name )
|
60
|
+
|
61
|
+
## check for readymade via series id
|
62
|
+
## allow some "literal" variants e.g.
|
63
|
+
## punk no.1 or no.001
|
64
|
+
## punk #1 or #001
|
65
|
+
## etc.
|
66
|
+
## and some more in the future - why? why not?
|
67
|
+
|
68
|
+
id = nil
|
69
|
+
|
70
|
+
img = if attributes.size == 1 && id=Originals.factory._parse_id( attributes[0] )
|
71
|
+
## check for known collection names
|
72
|
+
## (mostly singular to plural) - keep? why? why not?
|
73
|
+
|
74
|
+
## add support for "virtual" phunks - move "upstream" to artbase - why? why not?
|
75
|
+
if ['phunk', 'phunks'].include?( key )
|
76
|
+
Artbase::Image.get( 'punks', id ).mirror
|
77
|
+
elsif ['morephunk', 'morephunks'].include?( key )
|
78
|
+
Artbase::Image.get( 'morepunks', id ).mirror
|
79
|
+
elsif ['bwphunk', 'bwphunks'].include?( key )
|
80
|
+
Artbase::Image.get( 'bwpunks', id ).mirror
|
81
|
+
elsif ['readymadephunk', 'readymadephunks'].include?( key )
|
82
|
+
Artbase::Image.get( 'readymadepunks', id ).mirror
|
83
|
+
elsif ['intlphunk', 'intlphunks'].include?( key )
|
84
|
+
Artbase::Image.get( 'intlpunks', id ).mirror
|
85
|
+
elsif ['phoonbird', 'phoonbirds',
|
86
|
+
'moonbhird', 'moonbhirds',
|
87
|
+
'bhird', 'bhirds'].include?( key )
|
88
|
+
Artbase::Image.get( 'moonbirds', id ).mirror
|
89
|
+
elsif ['moonbirdphunk', 'moonbirdphunks',
|
90
|
+
'birdphunk', 'birdphunks'].include?( key )
|
91
|
+
Artbase::Image.get( 'moonbirdpunks', id ).mirror
|
92
|
+
else
|
93
|
+
collection = Artbase::COLLECTIONS[ key ] || key
|
94
|
+
Artbase::Image.get( collection, id )
|
95
|
+
end
|
96
|
+
else
|
97
|
+
Original::Image.fabricate( key, *attributes )
|
98
|
+
end
|
99
|
+
|
100
|
+
if img.nil?
|
101
|
+
puts "!! ERROR - don't know how to fabricate >#{name}<; sorry"
|
102
|
+
exit 1
|
103
|
+
end
|
56
104
|
|
57
|
-
|
58
|
-
|
105
|
+
|
106
|
+
## note: keep adding background as a separate step for now
|
107
|
+
if options[ :background]
|
108
|
+
## hack: for now for artbase collections
|
109
|
+
## try to remove background if any
|
110
|
+
## keep? why? why not?
|
111
|
+
img = img.transparent if id
|
112
|
+
|
113
|
+
## note: support multiple backgrounds
|
114
|
+
## via + for now e.g.
|
115
|
+
## blue+rainbow1
|
116
|
+
## add more separators - why? why not?
|
117
|
+
backgrounds = options[ :background].split( '+' )
|
118
|
+
backgrounds = backgrounds.map {|background| background.strip }
|
119
|
+
|
120
|
+
img = img.background( *backgrounds )
|
121
|
+
end
|
59
122
|
|
60
123
|
|
124
|
+
basename = String.new('') ## note: start with our own string buffer
|
125
|
+
## otherwise assigned first string gets modified!!
|
126
|
+
basename += options[:name] ? options[:name] : key
|
61
127
|
|
62
|
-
basename
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
128
|
+
basename += if options[:id]
|
129
|
+
options[:id]
|
130
|
+
elsif id
|
131
|
+
id.to_s
|
132
|
+
else
|
133
|
+
'' # add nothing
|
134
|
+
end
|
67
135
|
|
68
136
|
|
69
137
|
path = if options[:zoom]
|
data/lib/originals/version.rb
CHANGED
data/lib/originals.rb
CHANGED
@@ -1,10 +1,14 @@
|
|
1
1
|
## 3rd party libs
|
2
|
+
require 'backgrounds'
|
3
|
+
|
2
4
|
require 'cryptopunks'
|
3
5
|
require 'shibainus'
|
4
6
|
require 'moonbirds'
|
5
7
|
require 'coolcats'
|
6
8
|
require 'nouns'
|
7
9
|
|
10
|
+
require 'webclient'
|
11
|
+
|
8
12
|
|
9
13
|
|
10
14
|
## our own code
|
@@ -28,127 +32,122 @@ end
|
|
28
32
|
##
|
29
33
|
# "wrap" fabricate inside Image - why? why not?
|
30
34
|
class Image
|
31
|
-
|
35
|
+
|
36
|
+
def self.fabricate( name, *attributes, background: nil )
|
32
37
|
## normalize name of series
|
33
38
|
## e.g. Shiba Inu => shibainu etc.
|
34
|
-
key =
|
35
|
-
|
36
|
-
img =
|
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
|
-
|
39
|
+
key = Originals.factory._norm_name( name )
|
40
|
+
|
41
|
+
img = if ['punk', 'punks',
|
42
|
+
'cryptopunk', 'cryptopunks'].include?( key )
|
43
|
+
Originals.factory.punk( *attributes )
|
44
|
+
elsif ['phunk', 'phunks',
|
45
|
+
'cryptophunk', 'cryptophunks'].include?( key )
|
46
|
+
Originals.factory.phunk( *attributes )
|
47
|
+
elsif ['marilyn', 'marilyns' ].include?( key )
|
48
|
+
Originals.factory.marilyn( *attributes )
|
49
|
+
elsif ['philip', 'philips',
|
50
|
+
'philipp', 'philipps' ].include?( key )
|
51
|
+
Originals.factory.philip( *attributes )
|
52
|
+
elsif ['doge', 'doges',
|
53
|
+
'shiba', 'shibas',
|
54
|
+
'shibainu', 'shibainus'].include?( key )
|
55
|
+
Originals.factory.shiba( *attributes )
|
56
|
+
elsif ['bird', 'birds',
|
57
|
+
'moonbird', 'moonbirds',
|
58
|
+
'owl', 'owls'].include?( key )
|
59
|
+
Originals.factory.bird( *attributes )
|
60
|
+
elsif ['coolcat', 'coolcats'].include?( key )
|
61
|
+
Originals.factory.coolcat( *attributes )
|
62
|
+
elsif ['noun', 'nouns'].include?( key )
|
63
|
+
Originals.factory.noun( *attributes )
|
64
|
+
else
|
65
|
+
return nil ## return nil
|
66
|
+
end
|
67
|
+
|
68
|
+
## note: keep add background as a separate (last) step for now - why? why not?
|
69
|
+
## note: support multiple backgrounds via array
|
70
|
+
## e.g. ['matrix1', 'rainbow2']
|
71
|
+
if background
|
72
|
+
img = if background.is_a?( Array )
|
73
|
+
img.background( *background )
|
74
|
+
else
|
75
|
+
img.background( background )
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
63
79
|
img
|
64
80
|
end
|
65
81
|
class << self
|
66
|
-
|
82
|
+
alias_method :fab, :fabricate
|
67
83
|
end
|
68
|
-
end # class Image
|
69
84
|
|
70
85
|
|
86
|
+
end # class Image
|
71
87
|
|
72
88
|
|
73
89
|
|
74
90
|
class Factory ## add Fabricator/Artist/Artfactory/? alias or such - why? why not?
|
75
91
|
|
76
|
-
|
92
|
+
|
93
|
+
def punk( *attributes )
|
77
94
|
## note: if no attributes passed in
|
78
95
|
## default to ['Male 2']
|
79
96
|
attributes = ['Male 2'] if attributes.size == 0
|
80
97
|
|
81
|
-
|
82
|
-
mirror: mirror,
|
83
|
-
background: background )
|
98
|
+
Cryptopunks::Image.generate( *attributes )
|
84
99
|
end
|
85
100
|
|
86
|
-
def phunk( *attributes
|
87
|
-
|
88
|
-
mirror: true,
|
89
|
-
background: background )
|
101
|
+
def phunk( *attributes )
|
102
|
+
punk( *attributes ).mirror
|
90
103
|
end
|
91
104
|
|
92
105
|
|
93
106
|
MARILYN_ATTRIBUTES = ['Female 3', 'Wild Blonde', 'Mole',
|
94
107
|
'Blue Eye Shadow']
|
95
108
|
|
96
|
-
def marilyn( *attributes
|
97
|
-
|
98
|
-
*attributes,
|
99
|
-
mirror: true,
|
100
|
-
background: background )
|
109
|
+
def marilyn( *attributes )
|
110
|
+
phunk( *MARILYN_ATTRIBUTES, *attributes )
|
101
111
|
end
|
102
112
|
|
103
113
|
|
104
114
|
PHILIP_ATTRIBUTES = ['Male 3']
|
105
|
-
def philip( *attributes
|
106
|
-
|
107
|
-
*attributes,
|
108
|
-
mirror: true,
|
109
|
-
background: background )
|
115
|
+
def philip( *attributes )
|
116
|
+
phunk( *PHILIP_ATTRIBUTES, *attributes )
|
110
117
|
end
|
111
118
|
|
112
119
|
|
113
120
|
|
114
121
|
## add method alias doge, shiba_inu etc. - why? why not?
|
115
|
-
def shiba( *attributes
|
122
|
+
def shiba( *attributes )
|
116
123
|
## note: if no attributes passed in
|
117
124
|
## default to ['Classic']
|
118
125
|
attributes = ['Classic'] if attributes.size == 0
|
119
126
|
|
120
|
-
|
121
|
-
doge = _background( doge, background ) if background
|
122
|
-
doge
|
127
|
+
Shiba::Image.generate( *attributes )
|
123
128
|
end
|
124
129
|
|
125
130
|
|
126
131
|
## add method alias moonbird, owl etc. - why? why not?
|
127
|
-
def bird( *attributes
|
132
|
+
def bird( *attributes )
|
128
133
|
attributes = ['Brave Glitch'] if attributes.size == 0
|
129
134
|
|
130
|
-
|
131
|
-
bird = _background( bird, background ) if background
|
132
|
-
bird
|
135
|
+
Moonbird::Image.generate( *attributes )
|
133
136
|
end
|
134
137
|
|
135
138
|
|
136
|
-
def coolcat( *attributes
|
137
|
-
|
138
|
-
cat = _background( cat, background ) if background
|
139
|
-
cat
|
139
|
+
def coolcat( *attributes )
|
140
|
+
Coolcat::Image.generate( *attributes )
|
140
141
|
end
|
141
142
|
|
142
143
|
|
143
|
-
def noun( *attributes
|
144
|
+
def noun( *attributes )
|
144
145
|
attributes = ['Body Grayscale 1',
|
145
146
|
'Checker Bigwalk Rainbow',
|
146
147
|
'Head Beer',
|
147
148
|
'Glasses Square Fullblack'] if attributes.size == 0
|
148
149
|
|
149
|
-
|
150
|
-
noun = _background( noun, background ) if background
|
151
|
-
noun
|
150
|
+
Noun::Image.generate( *attributes )
|
152
151
|
end
|
153
152
|
|
154
153
|
|
@@ -157,36 +156,23 @@ end
|
|
157
156
|
###
|
158
157
|
# helpers
|
159
158
|
|
160
|
-
def
|
161
|
-
|
162
|
-
background: nil )
|
163
|
-
punk = Cryptopunks::Image.generate( *attributes )
|
164
|
-
|
165
|
-
punk = punk.mirror if mirror
|
166
|
-
## note: add background as LAST step (after mirror operation)
|
167
|
-
## that is, if mirror=true background will NOT get mirrored
|
168
|
-
punk = _background( punk, background ) if background
|
169
|
-
punk
|
159
|
+
def _norm_name( str )
|
160
|
+
str.downcase.gsub( /[ ()_-]/, '' )
|
170
161
|
end
|
171
162
|
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
end
|
183
|
-
|
184
|
-
img2 = Image.new( width, width )
|
185
|
-
img2.compose!( img )
|
186
|
-
img2.compose!( base )
|
187
|
-
img2
|
163
|
+
def _parse_id( str )
|
164
|
+
if str.gsub( /[ #()№º._-]/, '' ) =~ /
|
165
|
+
^(no|n|id)?
|
166
|
+
(?<id>[0-9]+)$
|
167
|
+
/ix
|
168
|
+
id = Regexp.last_match[:id].to_i(10) ## note: add base 10 (for 008 or such)
|
169
|
+
id
|
170
|
+
else
|
171
|
+
nil # retur nil if no match
|
172
|
+
end
|
188
173
|
end
|
189
174
|
|
175
|
+
|
190
176
|
end # class Factory
|
191
177
|
|
192
178
|
|
@@ -194,7 +180,7 @@ end # module Originals
|
|
194
180
|
|
195
181
|
|
196
182
|
|
197
|
-
|
183
|
+
require 'originals/service'
|
198
184
|
require 'originals/tool'
|
199
185
|
|
200
186
|
|
metadata
CHANGED
@@ -1,15 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: originals
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gerald Bauer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-06-
|
11
|
+
date: 2022-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: backgrounds
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
13
27
|
- !ruby/object:Gem::Dependency
|
14
28
|
name: cryptopunks
|
15
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,6 +94,20 @@ dependencies:
|
|
80
94
|
- - ">="
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: webclient
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
83
111
|
- !ruby/object:Gem::Dependency
|
84
112
|
name: rdoc
|
85
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -136,6 +164,7 @@ files:
|
|
136
164
|
- bin/fab
|
137
165
|
- bin/fabricate
|
138
166
|
- lib/originals.rb
|
167
|
+
- lib/originals/service.rb
|
139
168
|
- lib/originals/tool.rb
|
140
169
|
- lib/originals/version.rb
|
141
170
|
homepage: https://github.com/pixelartexchange/originals
|