zpng 0.4.3 → 0.4.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2cceb23c5330f39f49baad1cb807e023e79e27cfdf6c9bb9afca1def11d43556
4
- data.tar.gz: 3985fed46171d58778e3d6ad8fe06e8c2e1e94dde884554dfde9495fe737d6da
3
+ metadata.gz: 99e5f2ae6f86a27757f442011a5fa365b06f4a4bf52c1348a6018bb0cc8b5f85
4
+ data.tar.gz: f435672e701c25224d5e61dba082131608567fbe14d86fbd4065495d460d2932
5
5
  SHA512:
6
- metadata.gz: 7e35dbd0d0f09a8aad7c8a0fce43f9a46ca9fa1c8a64d1ca1b20452e1273018bc01deb1dba00e4ec07ff0b8d27b80510b27078eeaf017a78224a1fce620cd12b
7
- data.tar.gz: 965d3ace9f810ccb433b6574c27b409168103d81f5f86cadab8450d012f4c81ce3fa44c19309d99d01ddde36fa14ff4b18bd345e59ab60616f3aa010c100bbe1
6
+ metadata.gz: ce27f95e40b522d1dd854ecb4619650e22a6fc2b5bd4c9aee6c3247e5d32bf98da6778343645723359bb05872e33a68cad9ad08dbc2fae7c0f09c123d6567675
7
+ data.tar.gz: 3f9ea93a539c4ef1f16900eab6b9e4a8e8f2be7aceed695778cf296dd151df642e1da8b4bff3ff23f34aa560c660816d99d46d462d431547f32455fcfa7375e8
data/Gemfile.lock CHANGED
@@ -30,7 +30,8 @@ GEM
30
30
  faraday-patron (1.0.0)
31
31
  faraday-rack (1.0.0)
32
32
  faraday-retry (1.0.3)
33
- git (1.11.0)
33
+ git (1.13.1)
34
+ addressable (~> 2.8)
34
35
  rchardet (~> 1.8)
35
36
  github_api (0.19.0)
36
37
  addressable (~> 2.4)
@@ -55,24 +56,24 @@ GEM
55
56
  jwt (2.4.1)
56
57
  kamelcase (0.0.2)
57
58
  semver2 (~> 3)
58
- mini_portile2 (2.8.0)
59
+ mini_portile2 (2.8.1)
59
60
  multi_json (1.15.0)
60
61
  multi_xml (0.6.0)
61
62
  multipart-post (2.2.3)
62
- nokogiri (1.13.6)
63
+ nokogiri (1.14.2)
63
64
  mini_portile2 (~> 2.8.0)
64
65
  racc (~> 1.4)
65
- oauth2 (1.4.9)
66
+ oauth2 (1.4.11)
66
67
  faraday (>= 0.17.3, < 3.0)
67
68
  jwt (>= 1.0, < 3.0)
68
69
  multi_json (~> 1.3)
69
70
  multi_xml (~> 0.5)
70
- rack (>= 1.2, < 3)
71
+ rack (>= 1.2, < 4)
71
72
  psych (4.0.4)
72
73
  stringio
73
74
  public_suffix (4.0.7)
74
- racc (1.6.0)
75
- rack (2.2.3.1)
75
+ racc (1.6.2)
76
+ rack (3.0.4.1)
76
77
  rainbow (3.1.1)
77
78
  rake (13.0.6)
78
79
  rchardet (1.8.0)
data/Rakefile CHANGED
@@ -23,6 +23,7 @@ Juwelier::Tasks.new do |gem|
23
23
  gem.authors = ["Andrey \"Zed\" Zaikin"]
24
24
  gem.executables = %w'zpng'
25
25
  gem.files.include "lib/**/*.rb"
26
+ gem.files.exclude "samples/**/*"
26
27
  # dependencies defined in Gemfile
27
28
  end
28
29
  Juwelier::RubygemsDotOrgTasks.new
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.4.3
1
+ 0.4.5
@@ -1,19 +1,20 @@
1
1
  module ZPNG
2
2
  class Adam7Decoder
3
- attr_accessor :image
3
+ attr_accessor :bpp
4
4
  attr_reader :scanlines_count
5
5
 
6
6
  # http://en.wikipedia.org/wiki/Adam7_algorithm#Passes
7
- def initialize img
8
- @image = img
7
+ def initialize width, height, bpp
8
+ @bpp = bpp
9
+ raise "Invalid BPP #{@bpp.inspect}" if @bpp.to_i == 0
9
10
  @widths = [
10
- [(img.width/8.0).ceil] * (img.height/8.0).ceil, # pass1
11
- [((img.width-4)/8.0).ceil] * (img.height/8.0).ceil, # pass2
12
- [(img.width/4.0).ceil] * ((img.height-4)/8.0).ceil, # pass3
13
- [((img.width-2)/4.0).ceil] * (img.height/4.0).ceil, # pass4
14
- [(img.width/2.0).ceil] * ((img.height-2)/4.0).ceil, # pass5
15
- [((img.width-1)/2.0).ceil] * (img.height/2.0).ceil, # pass6
16
- [img.width] * ((img.height-1)/2.0).ceil # pass7
11
+ [(width/8.0).ceil] * (height/8.0).ceil, # pass1
12
+ [((width-4)/8.0).ceil] * (height/8.0).ceil, # pass2
13
+ [(width/4.0).ceil] * ((height-4)/8.0).ceil, # pass3
14
+ [((width-2)/4.0).ceil] * (height/4.0).ceil, # pass4
15
+ [(width/2.0).ceil] * ((height-2)/4.0).ceil, # pass5
16
+ [((width-1)/2.0).ceil] * (height/2.0).ceil, # pass6
17
+ [width] * ((height-1)/2.0).ceil # pass7
17
18
  ].map{ |x| x == [0] ? [] : x }
18
19
  @scanlines_count = 0
19
20
  # two leading zeroes added specially for convert_coords() code readability
@@ -28,7 +29,7 @@ module ZPNG
28
29
 
29
30
  # scanline size in bytes, INCLUDING leading filter byte
30
31
  def scanline_size idx
31
- (scanline_width(idx) * image.bpp / 8.0).ceil + 1
32
+ (scanline_width(idx) * bpp / 8.0).ceil + 1
32
33
  end
33
34
 
34
35
  # scanline offset in imagedata
data/lib/zpng/chunk.rb CHANGED
@@ -51,10 +51,10 @@ module ZPNG
51
51
  end
52
52
  end
53
53
 
54
- def export
54
+ def export( fix_crc: true )
55
55
  @data = self.export_data # virtual
56
56
  @size = @data.size # XXX hmm.. is it always is?
57
- fix_crc!
57
+ fix_crc! if fix_crc
58
58
  [@size,@type].pack('Na4') + @data + [@crc].pack('N')
59
59
  end
60
60
 
@@ -98,6 +98,9 @@ module ZPNG
98
98
  class IHDR < Chunk
99
99
  attr_accessor :width, :height, :depth, :color, :compression, :filter, :interlace
100
100
 
101
+ SIZE = 13
102
+ FORMAT = 'NNC5'
103
+
101
104
  PALETTE_USED = 1
102
105
  COLOR_USED = 2
103
106
  ALPHA_USED = 4
@@ -130,8 +133,6 @@ module ZPNG
130
133
  COLOR_RGBA => [ 8, 16 ],
131
134
  }
132
135
 
133
- FORMAT = 'NNC5'
134
-
135
136
  def initialize x
136
137
  super
137
138
  vars = %w'width height depth color compression filter interlace' # order is important
@@ -173,7 +174,7 @@ module ZPNG
173
174
  @filter ||= 0
174
175
  @interlace ||= 0
175
176
 
176
- unless ALLOWED_DEPTHS[@color].include?(@depth)
177
+ unless ALLOWED_DEPTHS[@color]&.include?(@depth)
177
178
  raise "[!] invalid color mode (#{@color.inspect}) / bit depth (#{@depth.inspect}) combination"
178
179
  end
179
180
  end
@@ -190,7 +191,8 @@ module ZPNG
190
191
 
191
192
  # bits per pixel
192
193
  def bpp
193
- SAMPLES_PER_COLOR[@color] * depth
194
+ spc = SAMPLES_PER_COLOR[@color]
195
+ spc ? spc * depth : nil
194
196
  end
195
197
 
196
198
  def color_used?
@@ -275,8 +277,32 @@ module ZPNG
275
277
  alias :<< :find_or_add
276
278
  end
277
279
 
280
+ class CHRM < Chunk
281
+ SIZE = 32
282
+ end
283
+
284
+ class GAMA < Chunk
285
+ SIZE = 4
286
+ end
287
+
278
288
  class IDAT < Chunk; end
279
- class IEND < Chunk; end
289
+
290
+ class TIME < Chunk
291
+ SIZE = 7
292
+ end
293
+
294
+ class IEND < Chunk
295
+ SIZE = 4
296
+ end
297
+
298
+ class PHYS < Chunk
299
+ SIZE = 9
300
+ end
301
+
302
+ class SRGB < Chunk
303
+ SIZE = 1
304
+ end
305
+
280
306
  class TRNS < Chunk; end
281
307
 
282
308
  end
data/lib/zpng/cli.rb CHANGED
@@ -179,13 +179,15 @@ module ZPNG
179
179
  color = %w'COLOR_GRAYSCALE COLOR_RGB COLOR_INDEXED COLOR_GRAY_ALPHA COLOR_RGBA'.find do |k|
180
180
  @img.hdr.color == ZPNG.const_get(k)
181
181
  end
182
- puts "[.] image size #{@img.width || '?'}x#{@img.height || '?'}, #{@img.bpp}bpp, #{color}"
182
+ puts "[.] image size #{@img.width || '?'}x#{@img.height || '?'}, #{@img.bpp || '?'}bpp, #{color}"
183
183
  puts "[.] palette = #{@img.palette}" if @img.palette
184
- puts "[.] uncompressed imagedata size = #{@img.imagedata_size} bytes"
184
+ puts "[.] uncompressed imagedata size = #{@img.imagedata_size || '?'} bytes"
185
185
  _conditional_hexdump(@img.imagedata, 3) if @options[:verbose] > 0
186
186
  end
187
187
 
188
188
  def _conditional_hexdump data, v2 = 2
189
+ return unless data
190
+
189
191
  if @options[:verbose] <= 0
190
192
  # do nothing
191
193
  elsif @options[:verbose] < v2
@@ -221,7 +223,11 @@ module ZPNG
221
223
  end
222
224
  puts "[.] #{chunk.inspect(@options[:verbose]).sub(chunk.type, colored_type)} #{colored_crc}"
223
225
 
224
- _conditional_hexdump(chunk.data) unless chunk.size == 0
226
+ if @options[:verbose] >= 3
227
+ _conditional_hexdump(chunk.export(fix_crc: false))
228
+ else
229
+ _conditional_hexdump(chunk.data)
230
+ end
225
231
  end
226
232
  end
227
233
 
data/lib/zpng/image.rb CHANGED
@@ -62,7 +62,7 @@ module ZPNG
62
62
  end
63
63
 
64
64
  def adam7
65
- @adam7 ||= Adam7Decoder.new(self)
65
+ @adam7 ||= Adam7Decoder.new(width, height, bpp)
66
66
  end
67
67
 
68
68
  class << self
@@ -119,7 +119,7 @@ module ZPNG
119
119
  io.seek(chunk.offset+delta, IO::SEEK_SET)
120
120
  potential_chunk = Chunk.new(io)
121
121
  if potential_chunk.valid?
122
- STDERR.puts "[!] heuristics: found invalid chunk at offset #{chunk.offset}, but valid one at #{chunk.offset+delta}. using latter".red
122
+ STDERR.puts "[!] heuristics: found invalid #{chunk.type.inspect} chunk at offset #{chunk.offset}, but valid #{potential_chunk.type.inspect} at #{chunk.offset+delta}. using latter".red
123
123
  if delta > 0
124
124
  io.seek(chunk.offset, IO::SEEK_SET)
125
125
  data = io.read(delta)
@@ -330,7 +330,7 @@ module ZPNG
330
330
  if new_image?
331
331
  @scanlines.map(&:size).inject(&:+)
332
332
  else
333
- imagedata.size
333
+ imagedata&.size
334
334
  end
335
335
  end
336
336
 
@@ -508,11 +508,14 @@ module ZPNG
508
508
  end
509
509
 
510
510
  def each_pixel &block
511
- height.times do |y|
512
- width.times do |x|
513
- yield(self[x,y], x, y)
511
+ e = Enumerator.new do |ee|
512
+ height.times do |y|
513
+ width.times do |x|
514
+ ee.yield(self[x,y], x, y)
515
+ end
514
516
  end
515
517
  end
518
+ block_given? ? e.each(&block) : e
516
519
  end
517
520
 
518
521
  # returns new deinterlaced image if deinterlaced
@@ -1,4 +1,7 @@
1
1
  #coding: binary
2
+
3
+ require 'set'
4
+
2
5
  module ZPNG
3
6
  class ScanLine
4
7
  FILTER_NONE = 0
@@ -39,6 +42,7 @@ module ZPNG
39
42
  STDERR.puts "[!] #{self.class}: ##@idx: no data at pos 0, scanline dropped".red
40
43
  end
41
44
  end
45
+ @errors = Set.new
42
46
  end
43
47
 
44
48
  # ScanLine is BAD if it has no filter
@@ -146,6 +150,24 @@ module ZPNG
146
150
  end # case image.hdr.color
147
151
  end
148
152
 
153
+ def get_raw x
154
+ return nil if @bpp > 8 || image.hdr.color != COLOR_INDEXED
155
+
156
+ raw =
157
+ if @BPP
158
+ # 8, 16, 24, 32, 48 bits per pixel
159
+ decoded_bytes[x*@BPP, @BPP]
160
+ else
161
+ # 1, 2 or 4 bits per pixel
162
+ decoded_bytes[x*@bpp/8]
163
+ end
164
+
165
+ mask = 2**@bpp-1
166
+ shift = 8-(x%(8/@bpp)+1)*@bpp
167
+ raise "invalid shift #{shift}" if shift < 0 || shift > 7
168
+ idx = (raw.ord >> shift) & mask
169
+ end
170
+
149
171
  def [] x
150
172
  raw =
151
173
  if @BPP
@@ -162,6 +184,20 @@ module ZPNG
162
184
  shift = 8-(x%(8/@bpp)+1)*@bpp
163
185
  raise "invalid shift #{shift}" if shift < 0 || shift > 7
164
186
  idx = (raw.ord >> shift) & mask
187
+ color = image.palette[idx]
188
+ unless color
189
+ if !@errors.include?(x) && @image.verbose >= -1
190
+ # prevent same error popping up multiple times, f.ex. in zsteg analysis
191
+ @errors << x
192
+ if (32..127).include?(idx)
193
+ msg = '[!] %s: color #%-3d ("%c") at x=%d y=%d is out of palette!'.red % [self.class, idx, idx, x, @idx]
194
+ else
195
+ msg = "[!] %s: color #%-3d at x=%d y=%d is out of palette!".red % [self.class, idx, x, @idx]
196
+ end
197
+ STDERR.puts msg
198
+ end
199
+ color = Color.new(0,0,0)
200
+ end
165
201
  if image.trns
166
202
  # transparency from tRNS chunk
167
203
  # For color type 3 (indexed color), the tRNS chunk contains a series of one-byte alpha values,
@@ -171,17 +207,14 @@ module ZPNG
171
207
  # Alpha for palette index 1: 1 byte
172
208
  # ...
173
209
  #
174
- color = image.palette[idx].dup
175
210
  if color.alpha = image.trns.data[idx]
176
211
  # if it's not NULL - convert it from char to int,
177
212
  # otherwise it means fully opaque color, as well as NULL alpha in ZPNG::Color
213
+ color = color.dup
178
214
  color.alpha = color.alpha.ord
179
215
  end
180
- return color
181
- else
182
- # no transparency
183
- return image.palette[idx]
184
216
  end
217
+ return color
185
218
 
186
219
  when COLOR_GRAYSCALE # ALLOWED_DEPTHS: 1, 2, 4, 8, 16
187
220
  c = if @bpp == 16
data/spec/adam7_spec.rb CHANGED
@@ -13,9 +13,7 @@ describe ZPNG::Adam7Decoder do
13
13
  }.each do |dims, slw|
14
14
  it "should be right for #{dims} image" do
15
15
  w,h = dims.split('x').map(&:to_i)
16
- img = Object.new
17
- allow(img).to receive_messages(:width => w, :height => h)
18
- adam7 = ZPNG::Adam7Decoder.new(img)
16
+ adam7 = ZPNG::Adam7Decoder.new(w, h, 8)
19
17
  slw.size.times.map{ |i| adam7.scanline_width(i) }.should == slw
20
18
  end
21
19
  end
@@ -34,9 +32,7 @@ describe ZPNG::Adam7Decoder do
34
32
  }.each do |dims, n|
35
33
  it "should be right for #{dims} image" do
36
34
  w,h = dims.split('x').map(&:to_i)
37
- img = Object.new
38
- allow(img).to receive_messages(:width => w, :height => h)
39
- adam7 = ZPNG::Adam7Decoder.new(img)
35
+ adam7 = ZPNG::Adam7Decoder.new(w, h, 8)
40
36
  adam7.scanlines_count.should == n
41
37
  end
42
38
  end
@@ -54,9 +50,7 @@ describe ZPNG::Adam7Decoder do
54
50
  }.each do |dims, pst|
55
51
  it "should be right for #{dims} image" do
56
52
  w,h = dims.split('x').map(&:to_i)
57
- img = Object.new
58
- allow(img).to receive_messages(:width => w, :height => h)
59
- adam7 = ZPNG::Adam7Decoder.new(img)
53
+ adam7 = ZPNG::Adam7Decoder.new(w, h, 8)
60
54
  adam7.instance_variable_get("@pass_starts").should == pst
61
55
  end
62
56
  end
@@ -15,9 +15,22 @@ each_sample("bad/*.png") do |fname|
15
15
  end
16
16
 
17
17
  it "should access 1st pixel" do
18
+ skip "no BPP" unless @img.bpp
18
19
  @img[0,0].should be_instance_of(ZPNG::Color)
19
20
  end
20
21
 
22
+ it "accessess all pixels" do
23
+ skip "no BPP" unless @img.bpp
24
+ skip if fname == 'samples/bad/b1.png'
25
+ skip if fname == 'samples/bad/000000.png'
26
+ n = 0
27
+ @img.each_pixel do |px|
28
+ px.should be_instance_of(ZPNG::Color)
29
+ n += 1
30
+ end
31
+ n.should == @img.width*@img.height
32
+ end
33
+
21
34
  describe "CLI" do
22
35
  it "shows info & chunks" do
23
36
  orig_stdout, out = $stdout, ""
@@ -31,6 +44,7 @@ each_sample("bad/*.png") do |fname|
31
44
  end
32
45
 
33
46
  it "shows scanlines" do
47
+ skip "no BPP" unless @img.bpp
34
48
  orig_stdout, out = $stdout, ""
35
49
  begin
36
50
  $stdout = StringIO.new(out)
@@ -1,5 +1,6 @@
1
1
  require File.expand_path(File.join(File.dirname(__FILE__), '/spec_helper'))
2
2
  require 'zpng/cli'
3
+ require 'set'
3
4
 
4
5
  PNGSuite.each_good do |fname|
5
6
  describe fname.sub(%r|\A#{Regexp::escape(Dir.getwd)}/?|, '') do
@@ -12,5 +13,38 @@ PNGSuite.each_good do |fname|
12
13
  end
13
14
  n.should == img.width*img.height
14
15
  end
16
+
17
+ it "accessess all pixels with coords" do
18
+ img = ZPNG::Image.load(fname)
19
+ n = 0
20
+ ax = Set.new
21
+ ay = Set.new
22
+ img.each_pixel do |px, x, y|
23
+ px.should be_instance_of(ZPNG::Color)
24
+ n += 1
25
+ ax << x
26
+ ay << y
27
+ end
28
+ n.should == img.width*img.height
29
+ ax.size.should == img.width
30
+ ay.size.should == img.height
31
+ end
32
+
33
+ it "accessess all pixels using method #2" do
34
+ img = ZPNG::Image.load(fname)
35
+ n = 0
36
+ a = img.each_pixel.to_a
37
+ ax = Set.new
38
+ ay = Set.new
39
+ a.each do |px, x, y|
40
+ px.should be_instance_of(ZPNG::Color)
41
+ n += 1
42
+ ax << x
43
+ ay << y
44
+ end
45
+ n.should == img.width*img.height
46
+ ax.size.should == img.width
47
+ ay.size.should == img.height
48
+ end
15
49
  end
16
50
  end
@@ -1,5 +1,5 @@
1
1
  module PNGSuite
2
- PNG_SUITE_URL = "http://www.schaik.com/pngsuite/PngSuite-2011apr25.tgz"
2
+ PNG_SUITE_URL = "http://www.schaik.com/pngsuite/PngSuite-2017jul19.tgz"
3
3
 
4
4
  class << self
5
5
  attr_accessor :dir
data/zpng.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: zpng 0.4.3 ruby lib
5
+ # stub: zpng 0.4.5 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "zpng".freeze
9
- s.version = "0.4.3"
9
+ s.version = "0.4.5"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Andrey \"Zed\" Zaikin".freeze]
14
- s.date = "2022-06-30"
14
+ s.date = "2023-02-19"
15
15
  s.email = "zed.0xff@gmail.com".freeze
16
16
  s.executables = ["zpng".freeze]
17
17
  s.extra_rdoc_files = [
@@ -51,25 +51,6 @@ Gem::Specification.new do |s|
51
51
  "lib/zpng/text_chunk.rb",
52
52
  "misc/chars.png",
53
53
  "misc/gen_ascii_map.rb",
54
- "samples/bad/000000.png",
55
- "samples/bad/149511457-47db5096-662d-4221-84f9-1c2a0e20e323.png",
56
- "samples/bad/b1.png",
57
- "samples/captcha_4bpp.png",
58
- "samples/cats.png",
59
- "samples/itxt.png",
60
- "samples/modify.rb",
61
- "samples/mouse.bmp",
62
- "samples/mouse.png",
63
- "samples/mouse17.bmp",
64
- "samples/mouse17.png",
65
- "samples/qr_aux_chunks.png",
66
- "samples/qr_bw.png",
67
- "samples/qr_gray_alpha.png",
68
- "samples/qr_grayscale.png",
69
- "samples/qr_plte.png",
70
- "samples/qr_plte_bw.png",
71
- "samples/qr_rgb.png",
72
- "samples/qr_rgba.png",
73
54
  "spec/adam7_spec.rb",
74
55
  "spec/alpha_spec.rb",
75
56
  "spec/ascii_spec.rb",
@@ -95,7 +76,7 @@ Gem::Specification.new do |s|
95
76
  ]
96
77
  s.homepage = "http://github.com/zed-0xff/zpng".freeze
97
78
  s.licenses = ["MIT".freeze]
98
- s.rubygems_version = "3.1.6".freeze
79
+ s.rubygems_version = "3.3.7".freeze
99
80
  s.summary = "pure ruby PNG file manipulation & validation".freeze
100
81
 
101
82
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zpng
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.3
4
+ version: 0.4.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey "Zed" Zaikin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-06-30 00:00:00.000000000 Z
11
+ date: 2023-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rainbow
@@ -107,25 +107,6 @@ files:
107
107
  - lib/zpng/text_chunk.rb
108
108
  - misc/chars.png
109
109
  - misc/gen_ascii_map.rb
110
- - samples/bad/000000.png
111
- - samples/bad/149511457-47db5096-662d-4221-84f9-1c2a0e20e323.png
112
- - samples/bad/b1.png
113
- - samples/captcha_4bpp.png
114
- - samples/cats.png
115
- - samples/itxt.png
116
- - samples/modify.rb
117
- - samples/mouse.bmp
118
- - samples/mouse.png
119
- - samples/mouse17.bmp
120
- - samples/mouse17.png
121
- - samples/qr_aux_chunks.png
122
- - samples/qr_bw.png
123
- - samples/qr_gray_alpha.png
124
- - samples/qr_grayscale.png
125
- - samples/qr_plte.png
126
- - samples/qr_plte_bw.png
127
- - samples/qr_rgb.png
128
- - samples/qr_rgba.png
129
110
  - spec/adam7_spec.rb
130
111
  - spec/alpha_spec.rb
131
112
  - spec/ascii_spec.rb
@@ -167,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
167
148
  - !ruby/object:Gem::Version
168
149
  version: '0'
169
150
  requirements: []
170
- rubygems_version: 3.1.6
151
+ rubygems_version: 3.3.7
171
152
  signing_key:
172
153
  specification_version: 4
173
154
  summary: pure ruby PNG file manipulation & validation
Binary file
data/samples/bad/b1.png DELETED
Binary file
Binary file
data/samples/cats.png DELETED
Binary file
data/samples/itxt.png DELETED
Binary file
data/samples/modify.rb DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env ruby
2
- require 'zpng'
3
- include ZPNG
4
-
5
- img = Image.new(File.join(File.dirname(__FILE__),"http.png"))
6
-
7
- puts "[.] original:"
8
- puts img.to_s
9
- puts
10
-
11
- img.width.times do |x|
12
- img[x,0] = (x % 2 == 0) ? Color::WHITE : Color::BLACK
13
- end
14
-
15
- puts "[.] modified:"
16
- puts img.to_s
17
-
18
- File.open("http-modified.png","wb") do |f|
19
- f << img.export
20
- end
data/samples/mouse.bmp DELETED
Binary file
data/samples/mouse.png DELETED
Binary file
data/samples/mouse17.bmp DELETED
Binary file
data/samples/mouse17.png DELETED
Binary file
Binary file
data/samples/qr_bw.png DELETED
Binary file
Binary file
Binary file
data/samples/qr_plte.png DELETED
Binary file
Binary file
data/samples/qr_rgb.png DELETED
Binary file
data/samples/qr_rgba.png DELETED
Binary file