artfactory 0.1.0 → 1.0.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 +107 -5
- data/Rakefile +4 -4
- data/lib/artfactory/artfactory.rb +12 -8
- data/lib/artfactory/base.rb +12 -0
- data/lib/artfactory/version.rb +2 -2
- data/lib/artfactory.rb +6 -11
- metadata +12 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5510b374cec095c795bec897961719a501cabb7e1341f026b1a5d301b838821b
|
4
|
+
data.tar.gz: d1324fc9a7706e1bf593657f903d2efad9b647f10f0448671c16e39ba4c30e43
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bc5af5ad4b1f44c07b115b49ca2a3827eaf72a159b38924b25e9fad0fda5a6dcf00579b4bf89589c8c81def106d0d2c8ad28a2251d6756677e68d71e182fd151
|
7
|
+
data.tar.gz: 70d335a1ae4014607ade5091c7105965b329f0d7ab9030fa6105834296fd8c7f5b1d4eed2852db22f3c2f651a006f1d585d19cacce9dcefea8b981c0d374ebd4
|
data/Manifest.txt
CHANGED
data/README.md
CHANGED
@@ -1,12 +1,11 @@
|
|
1
|
-
|
2
1
|
# Art Factory
|
3
2
|
|
4
|
-
Yes, you can! Generate your own
|
3
|
+
Yes, you can! Generate your own art images from text attributes (via spritesheets); incl. 2x/4x/8x zoom for bigger sizes and more
|
5
4
|
|
6
5
|
|
7
6
|
|
8
|
-
* home :: [github.com/
|
9
|
-
* bugs :: [github.com/
|
7
|
+
* home :: [github.com/generativeartfactory/artfactory](https://github.com/generativeartfactory/artfactory)
|
8
|
+
* bugs :: [github.com/generativeartfactory/artfactory/issues](https://github.com/generativeartfactory/artfactory/issues)
|
10
9
|
* gem :: [rubygems.org/gems/artfactory](https://rubygems.org/gems/artfactory)
|
11
10
|
* rdoc :: [rubydoc.info/gems/artfactory](http://rubydoc.info/gems/artfactory)
|
12
11
|
|
@@ -15,8 +14,111 @@ Yes, you can! Generate your own pixel art images (off chain) from text attribute
|
|
15
14
|
|
16
15
|
## Usage
|
17
16
|
|
17
|
+
Let's try punk doge shiba inus in the 24x24px format.
|
18
|
+
|
19
|
+
![](sandbox/config/spritesheet.png)
|
20
|
+
|
21
|
+
(Source: [config/spritesheet.png](sandbox/config/spritesheet.png))
|
22
|
+
|
23
|
+
```
|
24
|
+
id, category, name, more_names
|
25
|
+
0, , classic,
|
26
|
+
1, , dark,
|
27
|
+
2, , zombie,
|
28
|
+
3, , alien,
|
29
|
+
4, , crazyhair,
|
30
|
+
5, , beanie,
|
31
|
+
6, , cap,
|
32
|
+
7, , capforward,
|
33
|
+
8, , cowboyhat,
|
34
|
+
9, , fedora,
|
18
35
|
...
|
36
|
+
```
|
37
|
+
|
38
|
+
(Source: [config/spritesheet.csv](sandbox/config/spritesheet.png))
|
39
|
+
|
40
|
+
|
41
|
+
|
42
|
+
### Setup Variant 1
|
43
|
+
|
44
|
+
|
45
|
+
``` ruby
|
46
|
+
require 'artfactory'
|
47
|
+
|
48
|
+
# step 1 - setup the art factory;
|
49
|
+
# pass-in the spritesheet image & (meta) dataset and
|
50
|
+
# the format (e.g. 24x24px)
|
51
|
+
|
52
|
+
shiba1 = Artfactory.read( './config/spritesheet.png',
|
53
|
+
'./config/spritesheet.csv',
|
54
|
+
width: 24,
|
55
|
+
height: 24)
|
56
|
+
|
57
|
+
|
58
|
+
# step 2 - generate images via text (prompts)
|
59
|
+
|
60
|
+
doge = shiba1.generate( 'Classic', '3D Glasses' )
|
61
|
+
doge.save( './doge1.png' )
|
62
|
+
doge.zoom(4).save( './doge1@4x.png' )
|
63
|
+
|
64
|
+
doge = shiba1.generate( 'Alien', 'Headband' )
|
65
|
+
doge.save( './doge2.png' )
|
66
|
+
doge.zoom(4).save( './doge2@4x.png' )
|
67
|
+
|
68
|
+
doge = doge.background( 'Matrix 1', 'Rainbow 1' )
|
69
|
+
doge.save( './doge2b.png' )
|
70
|
+
doge.zoom(4).save( './doge2b@4x.png' )
|
71
|
+
```
|
72
|
+
|
73
|
+
Resulting in:
|
74
|
+
|
75
|
+
![](i/doge1.png)
|
76
|
+
![](i/doge2.png)
|
77
|
+
![](i/doge2b.png)
|
78
|
+
|
79
|
+
4x:
|
80
|
+
![](i/doge1@4x.png)
|
81
|
+
![](i/doge2@4x.png)
|
82
|
+
![](i/doge2b@4x.png)
|
83
|
+
|
84
|
+
|
85
|
+
|
86
|
+
|
87
|
+
### Setup Variant 2
|
88
|
+
|
89
|
+
``` ruby
|
90
|
+
require 'artfactory'
|
91
|
+
|
92
|
+
# step 1 - setup the art factory;
|
93
|
+
# use an "external" spritesheet configuration
|
94
|
+
|
95
|
+
sheet = Pixelart::Spritesheet.read( './config/spritesheet.png',
|
96
|
+
'./config/spritesheet.csv',
|
97
|
+
width: 24,
|
98
|
+
height: 24)
|
99
|
+
shiba2 = Artfactory.use( sheet )
|
100
|
+
|
101
|
+
|
102
|
+
# step 2 - generate images via text (prompts)
|
103
|
+
|
104
|
+
doge = shiba2.generate( 'Classic', '3D Glasses' )
|
105
|
+
doge.save( './doge1.png' )
|
106
|
+
doge.zoom(4).save( './doge1@4x.png' )
|
107
|
+
|
108
|
+
|
109
|
+
doge = shiba2.generate( 'Alien', 'Headband' )
|
110
|
+
doge.save( './doge2.png' )
|
111
|
+
doge.zoom(4).save( './doge2@4x.png' )
|
112
|
+
|
113
|
+
doge = doge.background( 'Matrix 1', 'Rainbow 1' )
|
114
|
+
doge.save( './doge2b.png' )
|
115
|
+
doge.zoom(4).save( './doge2b@4x.png' )
|
116
|
+
```
|
117
|
+
|
118
|
+
|
119
|
+
|
19
120
|
|
20
121
|
## Questions? Comments?
|
21
122
|
|
22
|
-
Post them
|
123
|
+
Post them over at the [Help & Support](https://github.com/geraldb/help) page. Thanks.
|
124
|
+
|
data/Rakefile
CHANGED
@@ -13,10 +13,10 @@ Hoe.spec 'artfactory' do
|
|
13
13
|
|
14
14
|
self.version = Pixelart::Module::Artfactory::VERSION
|
15
15
|
|
16
|
-
self.summary = "artfactory - generate your own
|
16
|
+
self.summary = "artfactory - generate your own art images from text attributes (via spritesheets); incl. 2x/4x/8x zoom for bigger sizes and more"
|
17
17
|
self.description = summary
|
18
18
|
|
19
|
-
self.urls = { home: 'https://github.com/
|
19
|
+
self.urls = { home: 'https://github.com/generativeartfactory/artfactory' }
|
20
20
|
|
21
21
|
self.author = 'Gerald Bauer'
|
22
22
|
self.email = 'wwwmake@googlegroups.com'
|
@@ -26,8 +26,8 @@ Hoe.spec 'artfactory' do
|
|
26
26
|
self.history_file = 'CHANGELOG.md'
|
27
27
|
|
28
28
|
self.extra_deps = [
|
29
|
-
['pixelart',
|
30
|
-
['backgrounds'],
|
29
|
+
['pixelart', '>= 1.3.2'],
|
30
|
+
['backgrounds', '>= 0.2.0'],
|
31
31
|
]
|
32
32
|
|
33
33
|
self.licenses = ['Public Domain']
|
@@ -10,22 +10,26 @@ class Artfactory
|
|
10
10
|
def self.read( image_path="./spritesheet.png",
|
11
11
|
meta_path="./spritesheet.csv",
|
12
12
|
width: 24,
|
13
|
-
height: 24
|
13
|
+
height: 24,
|
14
|
+
image_class: Pixelart::Image )
|
14
15
|
|
15
16
|
sheet = Pixelart::Spritesheet.read( image_path,
|
16
17
|
meta_path,
|
17
18
|
width: width, height: height )
|
18
|
-
new( sheet )
|
19
|
+
new( sheet, image_class: image_class )
|
19
20
|
end
|
20
21
|
|
21
|
-
def self.use( sheet ) ### check - allow more sheets - why? why not?
|
22
|
-
new( sheet )
|
22
|
+
def self.use( sheet, image_class: Pixelart::Image ) ### check - allow more sheets - why? why not?
|
23
|
+
new( sheet, image_class: image_class )
|
23
24
|
end
|
24
25
|
|
25
26
|
|
26
27
|
|
27
|
-
def initialize( sheet )
|
28
|
-
@sheet
|
28
|
+
def initialize( sheet, image_class: )
|
29
|
+
@sheet = sheet
|
30
|
+
@image_class = image_class
|
31
|
+
|
32
|
+
puts " [artfactory] using image class >#{@image_class.name}< for #{@sheet.image.tile_width}x#{@sheet.image.tile_height} images"
|
29
33
|
end
|
30
34
|
|
31
35
|
def spritesheet() @sheet; end
|
@@ -55,8 +59,8 @@ class Artfactory
|
|
55
59
|
|
56
60
|
## note: first construct/generate image on transparent background
|
57
61
|
## add background if present as LAST step
|
58
|
-
img =
|
59
|
-
|
62
|
+
img = @image_class.new( @sheet.image.tile_width,
|
63
|
+
@sheet.image.tile_height )
|
60
64
|
|
61
65
|
recs.each do |rec|
|
62
66
|
## note: before call(back) MUST change image INPLACE!!!!
|
data/lib/artfactory/version.rb
CHANGED
data/lib/artfactory.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
|
-
##
|
2
|
-
require '
|
3
|
-
require 'backgrounds/base'
|
1
|
+
## our own code (without "top-level" shortcuts e.g. "modular version")
|
2
|
+
require 'artfactory/base' # aka "strict(er)" version
|
4
3
|
|
5
4
|
|
6
|
-
|
7
|
-
|
8
|
-
|
5
|
+
###
|
6
|
+
# add convenience top-level shortcuts / aliases
|
7
|
+
# make Image, Color, Palette8bit, etc top-level
|
8
|
+
include Pixelart
|
9
9
|
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
puts Pixelart::Module::Artfactory.banner # say hello
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: artfactory
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.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:
|
11
|
+
date: 2023-04-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pixelart
|
@@ -16,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.3.
|
19
|
+
version: 1.3.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.3.
|
26
|
+
version: 1.3.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: backgrounds
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 0.2.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 0.2.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rdoc
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -72,8 +72,8 @@ dependencies:
|
|
72
72
|
- - "~>"
|
73
73
|
- !ruby/object:Gem::Version
|
74
74
|
version: '3.23'
|
75
|
-
description: artfactory - generate your own
|
76
|
-
|
75
|
+
description: artfactory - generate your own art images from text attributes (via
|
76
|
+
spritesheets); incl. 2x/4x/8x zoom for bigger sizes and more
|
77
77
|
email: wwwmake@googlegroups.com
|
78
78
|
executables: []
|
79
79
|
extensions: []
|
@@ -88,8 +88,9 @@ files:
|
|
88
88
|
- Rakefile
|
89
89
|
- lib/artfactory.rb
|
90
90
|
- lib/artfactory/artfactory.rb
|
91
|
+
- lib/artfactory/base.rb
|
91
92
|
- lib/artfactory/version.rb
|
92
|
-
homepage: https://github.com/
|
93
|
+
homepage: https://github.com/generativeartfactory/artfactory
|
93
94
|
licenses:
|
94
95
|
- Public Domain
|
95
96
|
metadata: {}
|
@@ -113,6 +114,6 @@ requirements: []
|
|
113
114
|
rubygems_version: 3.3.7
|
114
115
|
signing_key:
|
115
116
|
specification_version: 4
|
116
|
-
summary: artfactory - generate your own
|
117
|
-
|
117
|
+
summary: artfactory - generate your own art images from text attributes (via spritesheets);
|
118
|
+
incl. 2x/4x/8x zoom for bigger sizes and more
|
118
119
|
test_files: []
|