Skip to content

Commit 276ef7b

Browse files
committed
up
1 parent df477ae commit 276ef7b

File tree

6 files changed

+53
-49
lines changed

6 files changed

+53
-49
lines changed

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
###
2-
# don't check in punks.png for testing
2+
# don't check in punks.png and cryptpunks.csv, cryptopunks-classic.csv
3+
# for testing
34
punks.png
5+
cryptopunks-classic.csv
6+
cryptopunks.csv
7+
48

59
###
610
# skip temporary files for testing only

01_rip.md renamed to 01_crop.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Do-It-Yourself (DIY) - Yes, You Can! - Rip & Save Your Own Punks in Original 24x24 Pixel Format or With 2X / 4X / 8X Zoom
1+
# Do-It-Yourself (DIY) - Yes, You Can! - Crop & Save Your Own Punks in Original 24x24 Pixel Format or With 2X / 4X / 8X Zoom
22

33

44
## Step 0 - Download the True Official Genuine Matt & John's® (Crypto) Punks composite image
@@ -13,7 +13,7 @@ See [`punks.png` »](https://github.com/larvalabs/cryptopunks/blob/master/punks.
1313

1414

1515

16-
Let's create a script to rip & save punks.
16+
Let's create a script to crop & save punks.
1717

1818
## Step 1 - Read True Official Genuine Matt & John's® (Crypto) Punks composite image
1919

@@ -25,7 +25,7 @@ punks = ImageComposite.read( './punks.png' )
2525
```
2626

2727

28-
## Step 2 - Start ripping
28+
## Step 2 - Start cropping
2929

3030
Note: By default punks get saved in the original 24x24 pixel format
3131
and the first punk starts at index zero, that is, `0`.
@@ -92,7 +92,7 @@ in the series.
9292

9393

9494

95-
Let's rip & save punk #0, #18, #40, and #88
95+
Let's crop & save punk #0, #18, #40, and #88
9696
and let's add an offset of 10000
9797
(to start counting at 10000 instead of 0) when saving to disk:
9898

@@ -135,7 +135,7 @@ Let's try the second pack - that is, punks 100 to 199 in the series.
135135

136136

137137

138-
Let's rip & save punk #0, #79, #80, and #90
138+
Let's crop & save punk #0, #79, #80, and #90
139139
and let's add an offset of 10100
140140
(to start counting at 10000 plus 100 instead of 0):
141141

@@ -170,7 +170,7 @@ And 4x:
170170
![](i/punk-10190x4.png)
171171

172172

173-
And so on. Happy miniting.
173+
And so on. Happy cropping & saving.
174174

175175

176176

@@ -179,7 +179,7 @@ And so on. Happy miniting.
179179

180180
## Frequently Asked Questions (F.A.Q.s) and Answers
181181

182-
### Q: How can I rip & save all punks from 0 to 9999 from the Matt & John's 24x24 series?
182+
### Q: How can I crop & save all punks from 0 to 9999 from the Matt & John's 24x24 series?
183183

184184

185185
Use a script with a loop like:
@@ -188,7 +188,7 @@ Use a script with a loop like:
188188
# step 1: read composite image
189189
punks = ImageComposite.read( './punks.png' )
190190

191-
# step 2: rip & save all punks
191+
# step 2: crop & save all punks
192192
(0..9999).each do |i|
193193
name = '%04d' % i
194194
punks[i].save( "./punk-#{name}.png" )

02_attributes.md

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,9 @@
1313

1414
Crypto collectibles are all about rarity - the more rare the type or accessories of a punk the more valuable the 24x24 pixel art in theory.
1515

16-
Let's use the [`cryptopunks.csv` dataset](https://github.com/cryptopunksnotdead/punks)
16+
Let's use the [`cryptopunks.csv` (classic) dataset](https://github.com/cryptopunksnotdead/punks)
1717
in comma-separated values (CSV) format
18-
that houses in blocks of a thousand punks each
19-
(e.g.
20-
`0-999.csv`,
21-
`1000-1999.csv`,
22-
`2000-2999.csv`, and so on)
23-
all the 10 000 punks for more insight into the population.
18+
that houses all the 10 000 punks for more insight into the population.
2419

2520

2621
The data records for punks
@@ -43,30 +38,30 @@ Let's read in the dataset:
4338

4439

4540
``` ruby
46-
require 'cryptopunks'
41+
require 'punks'
4742

48-
punks = Punks::Dataset.read( './punks/*.csv' )
43+
punks = Punks::Dataset.read( './cryptopunks-classic.csv' )
4944
punks.size
5045
#=> 10000
5146
```
5247

53-
Let the cryptopunks helper do the heavy lifting :-).
48+
Let the punk dataset helper do the heavy lifting :-).
5449
As a bonus all punks get wrapped into easy-to-access structs.
5550
Example:
5651

5752
``` ruby
5853
punk = punks[0]
5954
punk.id
6055
#=> 0
61-
punk.type.name
56+
punk.type
6257
#=> "Female"
6358
punk.accessories.size
6459
#=> 3
65-
punk.accessories[0].name
60+
punk.accessories[0]
6661
#=> "Green Eye Shadow"
67-
punk.accessories[1].name
62+
punk.accessories[1]
6863
#=> "Earring"
69-
punk.accessories[2].name
64+
punk.accessories[2]
7065
#=> "Blonde Bob"
7166
```
7267

@@ -78,7 +73,7 @@ Let's calculate popularity & rarity by punk types:
7873
``` ruby
7974
counter = Hash.new(0) # a hash (table) - let's (auto-)default to 0 for values
8075
punks.each do |punk|
81-
counter[ punk.type.name ] += 1
76+
counter[ punk.type ] += 1
8277
end
8378

8479
counter.size
@@ -129,12 +124,12 @@ let's break out the count by punk type:
129124
counter = {}
130125
punks.each do |punk|
131126
punk.accessories.each do |acc|
132-
rec = counter[ acc.name ] ||= { count: 0,
133-
by_type: Hash.new(0)
134-
}
127+
rec = counter[ acc ] ||= { count: 0,
128+
by_type: Hash.new(0)
129+
}
135130

136131
rec[ :count ] += 1
137-
rec[ :by_type ][ punk.type.name ] += 1
132+
rec[ :by_type ][ punk.type ] += 1
138133
end
139134
end
140135

@@ -323,6 +318,8 @@ stats on the 10 000 punk population.
323318

324319

325320

321+
<!--
322+
326323
**REMINDER: In the digitial world there are no originals! Every copy is a original and you cannot tell the difference
327324
(all 0s and 1s are the same). And, yes, you can always make as many (free) copies as you like (in a free world).
328325
Claiming that you can protect your exclusive rights to pixels because the record of ownership
@@ -333,3 +330,7 @@ Check your license agreement with LarvaLabs - the pixel art license seller - and
333330
You are a licensee and NOT an owner.**
334331
335332
333+
-->
334+
335+
336+

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ _Inside Unique 24×24 Pixel Art on the Blockchain..._
1818

1919
by [Gerald Bauer](https://github.com/geraldb), et al
2020

21-
- [Do-It-Yourself (DIY) - Yes, You Can! - Rip & Save Your Own Punks in Original 24x24 Pixel Format or With 2X / 4X / 8X Zoom](01_rip.md)
21+
- [Do-It-Yourself (DIY) - Yes, You Can! - Crop & Save Your Own Punks in Original 24x24 Pixel Format or With 2X / 4X / 8X Zoom](01_crop.md)
2222
- [Statistics, Statistics, Statistics - Calculate Rarity & Popularity By Type, By Accessories, & More - Inside the Matt & John's® 10 000 Punks Population](02_attributes.md)
2323
- [Inside the Punk Art Machinery - How To Generate 10 000 Punks (and Punkettes), Algorithmically - Paint by Numbers](03_generate.md)
2424
- [10 000 More Punks - Inside the Punk Art Machinery (Continued) - How To Generate Punks, Algorithmically - Paint by Numbers - A New Punk Series](04_generate_ii.md)

attributes.rb

Lines changed: 18 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,42 +4,41 @@
44

55

66

7-
require 'cryptopunks'
7+
require 'punks'
88

9-
punks = Punks::Dataset.read( './punks/*.csv' )
10-
punks.size
9+
punks = Punks::Dataset.read( './cryptopunks-classic.csv' )
10+
pp punks.size
1111
#=> 10000
1212

1313

1414

1515
punk = punks[0]
16-
punk.id
16+
pp punk.id
1717
#=> 0
18-
punk.type.name
18+
pp punk.type
1919
#=> "Female"
20-
punk.accessories.size
20+
pp punk.accessories.size
2121
#=> 3
22-
punk.accessories[0].name
22+
pp punk.accessories[0]
2323
#=> "Green Eye Shadow"
24-
punk.accessories[1].name
24+
pp punk.accessories[1]
2525
#=> "Earring"
26-
punk.accessories[2].name
26+
pp punk.accessories[2]
2727
#=> "Blonde Bob"
2828

2929

3030

3131

32-
3332
## Popularity & Rarity by Punk Types (5)
3433

3534
counter = Hash.new(0) # a hash (table) - let's (auto-)default to 0 for values
3635
punks.each do |punk|
37-
counter[ punk.type.name ] += 1
36+
counter[ punk.type ] += 1
3837
end
3938

40-
counter.size
39+
pp counter.size
4140
#=> 5
42-
counter
41+
pp counter
4342
#=> {"Female"=>3840, "Male"=>6039, "Zombie"=>88, "Ape"=>24, "Alien"=>9}
4443

4544

@@ -61,18 +60,18 @@
6160
counter = {}
6261
punks.each do |punk|
6362
punk.accessories.each do |acc|
64-
rec = counter[ acc.name ] ||= { count: 0,
63+
rec = counter[ acc ] ||= { count: 0,
6564
by_type: Hash.new(0)
6665
}
6766

6867
rec[ :count ] += 1
69-
rec[ :by_type ][ punk.type.name ] += 1
68+
rec[ :by_type ][ punk.type ] += 1
7069
end
7170
end
7271

73-
counter.size
72+
pp counter.size
7473
#=> 87
75-
counter
74+
pp counter
7675
#=> {"Green Eye Shadow"=>{:count=>271,
7776
# :by_type=>{"Female"=>271}},
7877
# "Earring"=>{:count=>2459,
@@ -109,9 +108,9 @@
109108
counter[ punk.accessories.size ] += 1
110109
end
111110

112-
counter.size
111+
pp counter.size
113112
#=> 8
114-
counter
113+
pp counter
115114
#=> {"3"=>4501, "2"=>3560, "1"=>333, "4"=>1420, "5"=>166, "0"=>8, "6"=>11, "7"=>1}
116115

117116

rip.rb renamed to crop.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
###
22
# to run use:
3-
# ruby ./rip.rb
3+
# ruby ./crop.rb
44

55

66
require 'pixelart'

0 commit comments

Comments
 (0)