cryptopunks 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db4841328c13e863838826b922663aef0e8e28d3f1b2f551e18e95fc4b8cc81b
4
- data.tar.gz: 0f1d9bb17816c0e7152c3a4fb403927aa5219528fa41931fb9fbcf23303a11e7
3
+ metadata.gz: 46893056723659824049de9a524ef3e684c0b17144952b5a4e24af8a780954b4
4
+ data.tar.gz: 9444d2f5353ae3cb8fae51317d99c53052b5435cc3b1f470da88963283b88c2f
5
5
  SHA512:
6
- metadata.gz: c73e7546c178138a62d8b39b4624a85f638ec18c1268537a0b198cf317b6200272c1506f7d0943f6b45594aa81af2fa7d8b628f67c851cabff854a659f65a190
7
- data.tar.gz: 513e3f4bfd838d7e57f24c6005e6161e1a4eeecdc46c6493deb06234105678c5ce7db70fac44226c948038257d443642f1c542f2de18e4e02a9bc0309642a157
6
+ metadata.gz: 17d6dbd68977c9a6748b9c56357483ac1f69f89ca174bcb083f7b75b200eec76a49a61bcc500e73e4f3b27d3d948732f36ceccf827e40fc138c85910a2a0218b
7
+ data.tar.gz: ba47af528c1d8c687b341f8b2496ee777fd7ea44ed4bc7d18fe7f80c5c8f05c32b59e824139371c7e9da645779212fe2af9f2a52f63c47ea3283ba0b947bd455
data/Manifest.txt CHANGED
@@ -6,7 +6,7 @@ bin/cryptopunk
6
6
  bin/punk
7
7
  lib/cryptopunks.rb
8
8
  lib/cryptopunks/attributes.rb
9
+ lib/cryptopunks/composite.rb
9
10
  lib/cryptopunks/dataset.rb
10
- lib/cryptopunks/image.rb
11
11
  lib/cryptopunks/structs.rb
12
12
  lib/cryptopunks/version.rb
data/README.md CHANGED
@@ -2,14 +2,14 @@
2
2
 
3
3
  cryptopunks - mint your own 24×24 pixel punk images off chain from the True Official Genuine CryptoPunks™ sha256-verified original 10 000 unique character collection; incl. 2x/4x/8x zoom for bigger sizes
4
4
 
5
- * home :: [github.com/rubycoco/blockchain](https://github.com/rubycoco/blockchain)
6
- * bugs :: [github.com/rubycoco/blockchain/issues](https://github.com/rubycoco/blockchain/issues)
5
+ * home :: [github.com/cryptopunksnotdead/cryptopunks](https://github.com/cryptopunksnotdead/cryptopunks)
6
+ * bugs :: [github.com/cryptopunksnotdead/cryptopunks/issues](https://github.com/cryptopunksnotdead/cryptopunks/issues)
7
7
  * gem :: [rubygems.org/gems/cryptopunks](https://rubygems.org/gems/cryptopunks)
8
8
  * rdoc :: [rubydoc.info/gems/cryptopunks](http://rubydoc.info/gems/cryptopunks)
9
9
 
10
10
 
11
11
  New to Crypto Punks?
12
- See the [**Awesome CryptoPunks Bubble (Anno 2021) - Modern 24×24 Pixel Crypto Art on the Blockchain** »](https://github.com/openblockchains/awesome-cryptopunks-bubble)
12
+ See the [**Awesome CryptoPunks Bubble (Anno 2021) - Modern 24×24 Pixel Crypto Art on the Blockchain** »](https://github.com/cryptopunksnotdead/awesome-cryptopunks-bubble)
13
13
 
14
14
 
15
15
  ## Command Line
@@ -27,10 +27,10 @@ Usage: cryptopunk [options] IDs
27
27
  Mint punk characters from composite (./punks.png) - for IDs use 0 to 9999
28
28
 
29
29
  Options:
30
- -z, --zoom=ZOOM Zoom factor x2, x4, x8, etc. (default: 1)
31
- -d, --dir=DIR Output directory (default: .)
32
- -f, --file=FILE True Official Genuine CryptoPunks™ composite image (default: ./punks.png)
33
- -h, --help Prints this help
30
+ -z, --zoom=ZOOM Zoom factor x2, x4, x8, etc. (default: 1)
31
+ -d, --dir=DIR Output directory (default: .)
32
+ -f, --file=FILE True Official Genuine CryptoPunks™ composite image (default: ./punks.png)
33
+ -h, --help Prints this help
34
34
  ```
35
35
 
36
36
 
@@ -42,7 +42,8 @@ in a single 2400×2400 image (~830 kb) for free.
42
42
  See [`punks.png` »](https://github.com/larvalabs/cryptopunks/blob/master/punks.png)
43
43
 
44
44
 
45
- ![](i/punks-zoom.png)
45
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punks-zoom.png)
46
+
46
47
 
47
48
 
48
49
 
@@ -65,9 +66,9 @@ printing:
65
66
 
66
67
  And voila!
67
68
 
68
- ![](i/punk-0000.png)
69
- ![](i/punk-2890.png)
70
- ![](i/punk-8219.png)
69
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-0000.png)
70
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-2890.png)
71
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-8219.png)
71
72
 
72
73
 
73
74
 
@@ -95,22 +96,22 @@ printing:
95
96
 
96
97
  And voila!
97
98
 
98
- ![](i/punk-0000x2.png)
99
- ![](i/punk-2890x2.png)
100
- ![](i/punk-8219x2.png)
99
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-0000x2.png)
100
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-2890x2.png)
101
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-8219x2.png)
101
102
 
102
103
  And x4:
103
104
 
104
- ![](i/punk-0000x4.png)
105
- ![](i/punk-2890x4.png)
106
- ![](i/punk-8219x4.png)
105
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-0000x4.png)
106
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-2890x4.png)
107
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-8219x4.png)
107
108
 
108
109
 
109
110
  And x8:
110
111
 
111
- ![](i/punk-0000x8.png)
112
- ![](i/punk-2890x8.png)
113
- ![](i/punk-8219x8.png)
112
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-0000x8.png)
113
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-2890x8.png)
114
+ ![](https://github.com/cryptopunksnotdead/cryptopunks/raw/master/cryptopunks/i/punk-8219x8.png)
114
115
 
115
116
 
116
117
  And so on.
@@ -119,31 +120,10 @@ And so on.
119
120
  ## Usage in Your Scripts
120
121
 
121
122
 
122
- Yes, you can mint punks in your own scripts.
123
- Example:
124
-
125
- ``` ruby
126
- require 'cryptopunks'
127
-
128
- # step 1: read True Official Genuine CryptoPunks™ composite image
129
- punks = Punks::Image.read( './punks.png' )
130
-
131
- # step 2: start minting
132
-
133
- punks[0].save( './punk-0000.png' )
134
- punks[2890].save( './punk-2890.png' )
135
- punks[8219].save( './punk-8219.png')
136
-
137
- # or change the zoom factor
138
- punks.zoom = 4 # use x4
139
-
140
- punks[0].save( './punk-0000x4.png' )
141
- punks[2890].save( './punk-2890x4.png' )
142
- punks[8219].save( './punk-8219x4.png')
143
- ```
144
-
145
- and so on. Happy miniting.
146
- That's all for now.
123
+ Yes, you can mint punks in your own scripts
124
+ and much more.
125
+ See the
126
+ [**Programming CryptoPunks & Copypastas Step-by-Step Booklet / Guide »**](https://github.com/cryptopunksnotdead/programming-cryptopunks)
147
127
 
148
128
 
149
129
 
@@ -162,4 +142,4 @@ Use it as you please with no restrictions whatsoever.
162
142
 
163
143
  ## Questions? Comments?
164
144
 
165
- Post them on the [cryptopunk reddit](https://www.reddit.com/r/cryptopunk). Thanks.
145
+ Post them on the [CryptoPunksDev reddit](https://old.reddit.com/r/CryptoPunksDev). Thanks.
data/Rakefile CHANGED
@@ -8,7 +8,7 @@ Hoe.spec 'cryptopunks' do
8
8
  self.summary = "cryptopunks - mint your own 24×24 pixel punk images off chain from the True Official Genuine CryptoPunks™ sha256-verified original 10 000 unique character collection; incl. 2x/4x/8x zoom for bigger sizes"
9
9
  self.description = summary
10
10
 
11
- self.urls = { home: 'https://github.com/rubycoco/blockchain' }
11
+ self.urls = { home: 'https://github.com/cryptopunksnotdead/cryptopunks' }
12
12
 
13
13
  self.author = 'Gerald Bauer'
14
14
  self.email = 'wwwmake@googlegroups.com'
@@ -18,8 +18,7 @@ Hoe.spec 'cryptopunks' do
18
18
  self.history_file = 'CHANGELOG.md'
19
19
 
20
20
  self.extra_deps = [
21
- ['crypto-lite'],
22
- ['chunky_png'],
21
+ ['pixelart'],
23
22
  ['csvreader'],
24
23
  ]
25
24
 
data/lib/cryptopunks.rb CHANGED
@@ -1,11 +1,11 @@
1
1
  ## 3rd party
2
- require 'crypto-lite'
3
- require 'chunky_png'
2
+ require 'pixelart'
4
3
  require 'csvreader'
5
4
 
6
5
 
6
+
7
7
  ## extra stdlibs
8
- require 'fileutils'
8
+ require 'digest'
9
9
  require 'optparse'
10
10
 
11
11
 
@@ -14,7 +14,7 @@ require 'optparse'
14
14
  require 'cryptopunks/version' # note: let version always go first
15
15
  require 'cryptopunks/attributes'
16
16
  require 'cryptopunks/structs'
17
- require 'cryptopunks/image'
17
+ require 'cryptopunks/composite'
18
18
  require 'cryptopunks/dataset'
19
19
 
20
20
 
@@ -59,26 +59,31 @@ class Tool
59
59
  pp opts
60
60
 
61
61
  puts "==> reading >#{opts[:file]}<..."
62
- punks = Image.read( opts[:file] )
62
+ punks = Image::Composite.read( opts[:file] )
63
63
 
64
64
 
65
65
  puts " setting zoom to #{opts[:zoom]}x" if opts[:zoom] != 1
66
- punks.zoom = opts[:zoom] ## note: always reset zoom even if 1
67
66
 
68
67
  ## make sure outdir exits (default is current working dir e.g. .)
69
68
  FileUtils.mkdir_p( opts[:outdir] ) unless Dir.exist?( opts[:outdir] )
70
69
 
71
70
  args.each_with_index do |arg,index|
72
71
  punk_index = arg.to_i
72
+
73
+ punk = punks[ punk_index ]
74
+
73
75
  punk_name = "punk-" + "%04d" % punk_index
74
76
 
75
77
  ## if zoom - add x2,x4 or such
76
- punk_name << "x#{opts[:zoom]}" if opts[:zoom] != 1
78
+ if opts[:zoom] != 1
79
+ punk = punk.zoom( opts[:zoom] )
80
+ punk_name << "x#{opts[:zoom]}"
81
+ end
77
82
 
78
83
  path = "#{opts[:outdir]}/#{punk_name}.png"
79
84
  puts "==> (#{index+1}/#{args.size}) minting punk ##{punk_index}; writing to >#{path}<..."
80
85
 
81
- punks[ punk_index ].save( path )
86
+ punk.save( path )
82
87
  end
83
88
 
84
89
  puts "done"
@@ -1,13 +1,13 @@
1
1
  module Cryptopunks
2
2
  class Image
3
+ class Composite ## nest Composite inside Image - why? why not?
4
+
5
+
3
6
  def self.read( path='./punks.png' )
4
7
  data = File.open( path, 'rb' ) { |f| f.read }
5
8
  new( data )
6
9
  end
7
10
 
8
-
9
- attr_accessor :zoom
10
-
11
11
  PUNK_ROWS = 100
12
12
  PUNK_COLS = 100
13
13
  PUNK_COUNT = PUNK_ROWS * PUNK_COLS ## 10_000 = 100x100 (24000x24000 pixel)
@@ -18,6 +18,7 @@ module Cryptopunks
18
18
  PUNK_HASH = 'ac39af4793119ee46bbff351d8cb6b5f23da60222126add4268e261199a2921b'
19
19
 
20
20
 
21
+
21
22
  def initialize( data )
22
23
  @punks = ChunkyPNG::Image.from_blob( data )
23
24
  puts " #{@punks.height}x#{@punks.width} (height x width)"
@@ -34,8 +35,12 @@ module Cryptopunks
34
35
  puts " Sorry, please download the original."
35
36
  exit 1
36
37
  end
38
+ end
39
+
37
40
 
38
- @zoom = 1
41
+ def sha256( data )
42
+ ## todo/check: or just use Digest::SHA256.hexdigest - why? why not?
43
+ Digest::SHA256.digest( data ).unpack( 'H*' )[0]
39
44
  end
40
45
 
41
46
 
@@ -49,36 +54,15 @@ module Cryptopunks
49
54
 
50
55
  def size() PUNK_COUNT; end
51
56
 
52
- def []( index )
53
- @zoom == 1 ? crop( index ) : scale( index, @zoom )
54
- end
55
-
56
57
 
57
- def crop( index )
58
+ def punk( index )
58
59
  y, x = index.divmod( PUNK_ROWS )
59
- @punks.crop( x*PUNK_WIDTH, y*PUNK_HEIGHT, PUNK_WIDTH, PUNK_HEIGHT )
60
+ img = @punks.crop( x*PUNK_WIDTH, y*PUNK_HEIGHT, PUNK_WIDTH, PUNK_HEIGHT )
61
+ Pixelart::Image.new( img.width, img.height, img ) ## wrap in pixelart image
60
62
  end
63
+ alias_method :[], :punk
61
64
 
62
65
 
63
- def scale( index, zoom )
64
- punk = ChunkyPNG::Image.new( PUNK_WIDTH*zoom, PUNK_HEIGHT*zoom,
65
- ChunkyPNG::Color::WHITE )
66
-
67
- ## (x,y) offset in big all-in-one punks image
68
- y, x = index.divmod( PUNK_ROWS )
69
-
70
- ## copy all 24x24 pixels
71
- PUNK_WIDTH.times do |i|
72
- PUNK_HEIGHT.times do |j|
73
- pixel = @punks[i+x*PUNK_WIDTH, j+y*PUNK_HEIGHT]
74
- zoom.times do |n|
75
- zoom.times do |m|
76
- punk[n+zoom*i,m+zoom*j] = pixel
77
- end
78
- end
79
- end
80
- end
81
- punk
82
- end
66
+ end ## class Composite
83
67
  end ## class Image
84
68
  end ## module Cryptopunks
@@ -4,7 +4,7 @@ module Cryptopunks
4
4
 
5
5
  MAJOR = 1
6
6
  MINOR = 1
7
- PATCH = 0
7
+ PATCH = 1
8
8
  VERSION = [MAJOR,MINOR,PATCH].join('.')
9
9
 
10
10
  def self.version
metadata CHANGED
@@ -1,31 +1,17 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cryptopunks
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gerald Bauer
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-02-14 00:00:00.000000000 Z
11
+ date: 2021-04-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: crypto-lite
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'
27
- - !ruby/object:Gem::Dependency
28
- name: chunky_png
14
+ name: pixelart
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - ">="
@@ -107,11 +93,11 @@ files:
107
93
  - bin/punk
108
94
  - lib/cryptopunks.rb
109
95
  - lib/cryptopunks/attributes.rb
96
+ - lib/cryptopunks/composite.rb
110
97
  - lib/cryptopunks/dataset.rb
111
- - lib/cryptopunks/image.rb
112
98
  - lib/cryptopunks/structs.rb
113
99
  - lib/cryptopunks/version.rb
114
- homepage: https://github.com/rubycoco/blockchain
100
+ homepage: https://github.com/cryptopunksnotdead/cryptopunks
115
101
  licenses:
116
102
  - Public Domain
117
103
  metadata: {}