image_size 1.4.2 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +5 -13
  2. data/.rubocop.yml +80 -0
  3. data/.rubocop_todo.yml +28 -0
  4. data/.travis.yml +25 -8
  5. data/CHANGELOG.markdown +117 -0
  6. data/Gemfile +7 -1
  7. data/README.markdown +69 -21
  8. data/image_size.gemspec +12 -4
  9. data/lib/image_size.rb +205 -87
  10. data/spec/image_size_spec.rb +79 -71
  11. data/spec/{test2.bmp → images/bmp/v2.42x50.bmp} +0 -0
  12. data/spec/{test3b.bmp → images/bmp/v3-bottom2top.42x50.bmp} +0 -0
  13. data/spec/{test3t.bmp → images/bmp/v3-top2bottom.42x50.bmp} +0 -0
  14. data/spec/images/cur/32x256.cur +0 -0
  15. data/spec/{test.gif → images/gif/668x481.gif} +0 -0
  16. data/spec/images/ico/32x256.ico +0 -0
  17. data/spec/images/jp2/163x402.jp2 +0 -0
  18. data/spec/images/jp2/176x373.jpx +0 -0
  19. data/spec/images/jp2/224x293.j2c +0 -0
  20. data/spec/images/jpeg/436x429.jpeg +0 -0
  21. data/spec/images/jpeg/extraneous-bytes.436x429.jpeg +0 -0
  22. data/spec/images/mng/61x42.mng +0 -0
  23. data/spec/{test.pcx → images/pcx/70x60.pcx} +0 -0
  24. data/spec/images/png/192x110.apng +0 -0
  25. data/spec/{test.png → images/png/640x532.png} +0 -0
  26. data/spec/images/pnm/22x25.pam +8 -0
  27. data/spec/images/pnm/22x25.pbm +0 -0
  28. data/spec/images/pnm/22x25.pgm +4 -0
  29. data/spec/images/pnm/22x25.ppm +4 -0
  30. data/spec/images/pnm/ascii.22x25.pbm +27 -0
  31. data/spec/images/pnm/ascii.22x25.pgm +28 -0
  32. data/spec/images/pnm/ascii.22x25.ppm +28 -0
  33. data/spec/{test.psd → images/psd/16x20.psd} +0 -0
  34. data/spec/{test.svg → images/svg/72x100.svg} +0 -0
  35. data/spec/{test.swf → images/swf/450x200.swf} +0 -0
  36. data/spec/images/tiff/big-endian.68x49.tiff +0 -0
  37. data/spec/images/tiff/little-endian.40x68.tiff +0 -0
  38. data/spec/images/webp/extended.16x32.webp +0 -0
  39. data/spec/images/webp/lossless.16x32.webp +0 -0
  40. data/spec/images/webp/lossy.16x32.webp +0 -0
  41. data/spec/{test.xbm → images/xbm/16x32.xbm} +0 -0
  42. data/spec/{test.xpm → images/xpm/24x32.xpm} +0 -0
  43. metadata +108 -55
  44. data/spec/test.cur +0 -0
  45. data/spec/test.ico +0 -0
  46. data/spec/test.jpg +0 -0
  47. data/spec/test.pbm +0 -0
  48. data/spec/test.pgm +0 -5
  49. data/spec/test.tif +0 -0
  50. data/spec/test2.jpg +0 -0
@@ -1,98 +1,106 @@
1
- $:.unshift File.join(File.dirname(__FILE__), '..', 'lib')
1
+ # frozen_string_literal: true
2
+
2
3
  require 'rspec'
3
4
  require 'image_size'
5
+ require 'tempfile'
4
6
 
5
7
  describe ImageSize do
6
- [
7
- ['test2.bmp', :bmp, 42, 50],
8
- ['test3b.bmp',:bmp, 42, 50],
9
- ['test3t.bmp',:bmp, 42, 50],
10
- ['test.gif', :gif, 668, 481],
11
- ['test.jpg', :jpeg, 320, 240],
12
- ['test2.jpg',:jpeg, 320, 240],
13
- ['test.pbm', :pbm, 85, 55],
14
- ['test.pcx', :pcx, 70, 60],
15
- ['test.pgm', :pgm, 90, 55],
16
- ['test.png', :png, 640, 532],
17
- ['test.psd', :psd, 16, 20],
18
- ['test.swf', :swf, 450, 200],
19
- ['test.tif', :tiff, 48, 64],
20
- ['test.xbm', :xbm, 16, 32],
21
- ['test.xpm', :xpm, 24, 32],
22
- ['test.svg', :svg, 72, 100],
23
- ['test.ico', :ico, 256, 27],
24
- ['test.cur', :cur, 50, 256],
25
- ['image_size_spec.rb', nil, nil, nil],
26
- ].each do |name, format, width, height|
27
- path = File.join(File.dirname(__FILE__), name)
28
- file_data = File.open(path, 'rb', &:read)
8
+ MAX_FILESIZE = 16_384
9
+
10
+ (Dir['spec/images/*/*.*'] + [__FILE__]).each do |path|
11
+ filesize = File.size(path)
12
+ warn "#{path} is too big #{filesize} (max #{MAX_FILESIZE})" if filesize > MAX_FILESIZE
29
13
 
30
- it "should get format and dimensions for #{name} given IO" do
31
- File.open(path, 'rb') do |fh|
32
- is = ImageSize.new(fh)
33
- expect([is.format, is.width, is.height]).to eq([format, width, height])
34
- expect(fh).not_to be_closed
35
- fh.rewind
36
- expect(fh.read).to eq(file_data)
14
+ describe "for #{path}" do
15
+ let(:name){ File.basename(path) }
16
+ let(:attributes) do
17
+ match = /(\d+)x(\d+)\.([^.]+)$/.match(name)
18
+ width, height, format = match[1].to_i, match[2].to_i, match[3].to_sym if match
19
+ size = format && [width, height]
20
+ {
21
+ :format => format,
22
+ :width => width,
23
+ :height => height,
24
+ :w => width,
25
+ :h => height,
26
+ :size => size,
27
+ }
37
28
  end
38
- end
29
+ let(:file_data){ File.open(path, 'rb', &:read) }
39
30
 
40
- it "should get format and dimensions for #{name} given StringIO" do
41
- io = StringIO.new(file_data)
42
- is = ImageSize.new(io)
43
- expect([is.format, is.width, is.height]).to eq([format, width, height])
44
- expect(io).not_to be_closed
45
- io.rewind
46
- expect(io.read).to eq(file_data)
47
- end
31
+ context 'given as data' do
32
+ it 'gets format and dimensions' do
33
+ data = file_data.dup
34
+ image_size = ImageSize.new(data)
35
+ expect(image_size).to have_attributes(attributes)
36
+ expect(data).to eq(file_data)
37
+ end
38
+ end
48
39
 
49
- it "should get format and dimensions for #{name} given file data" do
50
- is = ImageSize.new(file_data)
51
- expect([is.format, is.width, is.height]).to eq([format, width, height])
52
- end
40
+ context 'given as IO' do
41
+ it 'gets format and dimensions' do
42
+ File.open(path, 'rb') do |io|
43
+ image_size = ImageSize.new(io)
44
+ expect(image_size).to have_attributes(attributes)
45
+ expect(io).not_to be_closed
46
+ expect(io.pos).to_not be_zero
47
+ io.rewind
48
+ expect(io.read).to eq(file_data)
49
+ end
50
+ end
51
+ end
53
52
 
54
- it "should get format and dimensions for #{name} given Tempfile" do
55
- Tempfile.open(name) do |tf|
56
- tf.binmode
57
- tf.write(file_data)
58
- tf.rewind
59
- is = ImageSize.new(tf)
60
- expect([is.format, is.width, is.height]).to eq([format, width, height])
61
- expect(tf).not_to be_closed
62
- tf.rewind
63
- expect(tf.read).to eq(file_data)
53
+ context 'given as StringIO' do
54
+ it 'gets format and dimensions' do
55
+ io = StringIO.new(file_data)
56
+ image_size = ImageSize.new(io)
57
+ expect(image_size).to have_attributes(attributes)
58
+ expect(io).not_to be_closed
59
+ expect(io.pos).to_not be_zero
60
+ io.rewind
61
+ expect(io.read).to eq(file_data)
62
+ end
64
63
  end
65
- end
66
64
 
67
- it "should get format and dimensions for #{name} given IO when run twice" do
68
- File.open(path, 'rb') do |fh|
69
- is = ImageSize.new(fh)
70
- expect([is.format, is.width, is.height]).to eq([format, width, height])
71
- is = ImageSize.new(fh)
72
- expect([is.format, is.width, is.height]).to eq([format, width, height])
65
+ context 'given as Tempfile' do
66
+ it 'gets format and dimensions' do
67
+ Tempfile.open(name) do |io|
68
+ io.binmode
69
+ io.write(file_data)
70
+ io.rewind
71
+ image_size = ImageSize.new(io)
72
+ expect(image_size).to have_attributes(attributes)
73
+ expect(io).not_to be_closed
74
+ expect(io.pos).to_not be_zero
75
+ io.rewind
76
+ expect(io.read).to eq(file_data)
77
+ end
78
+ end
73
79
  end
74
- end
75
80
 
76
- it "should get format and dimensions for #{name} as path" do
77
- is = ImageSize.path(path)
78
- expect([is.format, is.width, is.height]).to eq([format, width, height])
81
+ context 'using path method' do
82
+ it 'gets format and dimensions' do
83
+ image_size = ImageSize.path(path)
84
+ expect(image_size).to have_attributes(attributes)
85
+ end
86
+ end
79
87
  end
80
88
  end
81
89
 
82
- it "should raise ArgumentError if argument is not valid" do
83
- expect {
90
+ it 'raises ArgumentError if argument is not valid' do
91
+ expect do
84
92
  ImageSize.new(Object)
85
- }.to raise_error(ArgumentError)
93
+ end.to raise_error(ArgumentError)
86
94
  end
87
95
 
88
96
  {
89
97
  :png => "\211PNG\r\n\032\n",
90
98
  :jpeg => "\377\330",
91
99
  }.each do |type, data|
92
- it "should raise FormatError if invalid #{type} given" do
93
- expect {
100
+ it "raises FormatError if invalid #{type} given" do
101
+ expect do
94
102
  ImageSize.new(data)
95
- }.to raise_error(ImageSize::FormatError)
103
+ end.to raise_error(ImageSize::FormatError)
96
104
  end
97
105
  end
98
106
  end
Binary file
File without changes
@@ -0,0 +1,8 @@
1
+ P7
2
+ WIDTH 22
3
+ HEIGHT 25
4
+ DEPTH 3
5
+ MAXVAL 255
6
+ TUPLTYPE RGB
7
+ ENDHDR
8
+ JMRGJONQVKNSRVZY^b{��|��osyz����Ǎ��v|�������UY_ORT�^_�ts�_b`FH�`aDGLHJPJMQfjnflplqu}�����u{�������nsw[`d]bgqv}aej>AFLLO�`c�ro�bdxORlsvZ_ccknS[^imrwz��������������ɑ��UY]���u{~��glosz~X^b�_^�li�lk���dimORWORWRUZY\a������������������UW\������]`ehmqOPU>AHfOR�lj�kjv}�KNSKOREILEIMTX[LQUAEJHJOZ]a_di���muz������=<BSUZrv|���}pt�jh�liPWZGJOIMPEILDHK=AE`eiuz~������}��������������XZ_MMR[^e�������ed�heHKPPSWFKNAFIMRV`hk���������nuxW\`V[_CHLu|����[^dBBGDHMBEJomr�hf�geJMSZ\aDILekn������dimPUYMNSBBGCDIFGLDEJ]`f���chlDGLT\^EMQ]MQ�ji�ecoehXadJMR���Y]a_afcdjORWKNTMTYJNRFFICCG]`d���z�==BFGLAEK�VX�ki�ec�nrLQWNSZdjmkqtBBHABGPX]^ltScgIMPCDHJJNQTX�����JKPPSX_^d�__�jf�ca�st�_bjX[jsw���^eh=@EIPUQX^RW\UY]JNR@AEegn���v{FFLmuy�]_�ec�gd�ca�zx�zx�po�cg~����y��YZ^CEIEGKSUZejnMRUZ]b���osxADIm[_�_`�ca�ec�db�st�|}�zy�vt�gh�ot�����Ϣ��ehlEGLX]`PRVX[_���dek7<@�RT�b_�a_�`^�ca�ux�{~�|z�yv�{w�rp�ii�����������ntwDDIgjn���`cjSSW�^^�gd�b`�`^�b`�yv�wx�xu�|x�yu�vs�vs�oo�ii�km������FHMimq���QX_x`d�fe�fb�da�b`�ca�wu�rp�vt�us�tr�vs�ts�sr�po�uv�ml�x|V[_gin���OU[�Z\�fc�ea�db�ca�b`�zx�tq�vt�us�wt�vs�wt�sq�rr�st�sq�giTX\SVZ���fbg�ce�eb�ca�ec�db�ec�yu�ur�sq�sr�vs�xu�xs�tq�xt�ws�xt�ihKMRchm���]NP�ge�eb�ca�db�ec�fd�zv�sq�rq�sr�rp�xu�so�rp�tq�qn�uq�bcHIN\bgo|�wQU�jh�fd�ca�b`�ca�ec�zy�xt�tr�vs�sr�sr�tq�sp�rp�kj�mk�^^HLPLOTfqv�UV�jf�ec�db�b`�cb�ca�ss�{w�us�tr�ur�wt�tq�qo�ro�lj�on�ZZ=BFNNTRZ_�YY�ie�db�db�`_�_^�`_�ij�~|�vs�ur�sq�pn�qo�ol�ji�mj�qn�Z]CFL]_dLIN�aa�fb�ca�cb�a`�__�]^x_^�{x�ws�wt�sp�pn�po�lknZ^�lk�pmxXYDINkrwkUX�mj�db�fdX[�Y\�`_�]]�gi�vs�us�xu�tr�nk�lj�nk�jj�mk�kjlPR?CGGIP�bb�pm�fd�da�Y\�]]�b_�`_�ru�ml�ur�wu�tr�pk�lg�oi�oj�pl�kiaMO;@EPGI�kj�he�fd�fc�b`�a^�b`�_^
Binary file
@@ -0,0 +1,4 @@
1
+ P5
2
+ 22 25
3
+ 255
4
+ MJQNU]��sÑ{��YRh�mLmGJMikp��z��r_aueALi�rXr^jZmz����ŗX�z�ky]k��hRRU\������W��`lPAT~|NNHHWPEJ]c�t��=Uv�s|VJLHG@dy�������ZM^��v|KSJEQg���t[ZG{�^BHEnx{M\Hj��hTNBDGE`�gGZLQ}yg_M�\adRNSMFC`�~=GE_yzPRipBBWj`LDJT��KS_n~w�i\q�d@OWVXMAg�zFtgz{w���j��ZEGUiQ]�sD_rwyx|���ss�ͩhG\R[�e;]wutw������u����sDj�cSm{vtv��������{w��Hl�We{zxvw����������~{Zi�Te{yxwv�����������qWV�ctywyxy�����������rMg�Qzywxyz�����������lIazY~zwvwy���������~�gKOo_yxvww~���������cANYe~xxutup�������w�cF_Jq{wxvtsd������x_�_HqZ�xzahvrm�����{�~VBIl�zweowu{{�������~Q?I||zzwuvt
@@ -0,0 +1,4 @@
1
+ P6
2
+ 22 25
3
+ 255
4
+ JMRGJONQVKNSRVZY^b{��|��osyz����Ǎ��v|�������UY_ORT�^_�ts�_b`FH�`aDGLHJPJMQfjnflplqu}�����u{�������nsw[`d]bgqv}aej>AFLLO�`c�ro�bdxORlsvZ_ccknS[^imrwz��������������ɑ��UY]���u{~��glosz~X^b�_^�li�lk���dimORWORWRUZY\a������������������UW\������]`ehmqOPU>AHfOR�lj�kjv}�KNSKOREILEIMTX[LQUAEJHJOZ]a_di���muz������=<BSUZrv|���}pt�jh�liPWZGJOIMPEILDHK=AE`eiuz~������}��������������XZ_MMR[^e�������ed�heHKPPSWFKNAFIMRV`hk���������nuxW\`V[_CHLu|����[^dBBGDHMBEJomr�hf�geJMSZ\aDILekn������dimPUYMNSBBGCDIFGLDEJ]`f���chlDGLT\^EMQ]MQ�ji�ecoehXadJMR���Y]a_afcdjORWKNTMTYJNRFFICCG]`d���z�==BFGLAEK�VX�ki�ec�nrLQWNSZdjmkqtBBHABGPX]^ltScgIMPCDHJJNQTX�����JKPPSX_^d�__�jf�ca�st�_bjX[jsw���^eh=@EIPUQX^RW\UY]JNR@AEegn���v{FFLmuy�]_�ec�gd�ca�zx�zx�po�cg~����y��YZ^CEIEGKSUZejnMRUZ]b���osxADIm[_�_`�ca�ec�db�st�|}�zy�vt�gh�ot�����Ϣ��ehlEGLX]`PRVX[_���dek7<@�RT�b_�a_�`^�ca�ux�{~�|z�yv�{w�rp�ii�����������ntwDDIgjn���`cjSSW�^^�gd�b`�`^�b`�yv�wx�xu�|x�yu�vs�vs�oo�ii�km������FHMimq���QX_x`d�fe�fb�da�b`�ca�wu�rp�vt�us�tr�vs�ts�sr�po�uv�ml�x|V[_gin���OU[�Z\�fc�ea�db�ca�b`�zx�tq�vt�us�wt�vs�wt�sq�rr�st�sq�giTX\SVZ���fbg�ce�eb�ca�ec�db�ec�yu�ur�sq�sr�vs�xu�xs�tq�xt�ws�xt�ihKMRchm���]NP�ge�eb�ca�db�ec�fd�zv�sq�rq�sr�rp�xu�so�rp�tq�qn�uq�bcHIN\bgo|�wQU�jh�fd�ca�b`�ca�ec�zy�xt�tr�vs�sr�sr�tq�sp�rp�kj�mk�^^HLPLOTfqv�UV�jf�ec�db�b`�cb�ca�ss�{w�us�tr�ur�wt�tq�qo�ro�lj�on�ZZ=BFNNTRZ_�YY�ie�db�db�`_�_^�`_�ij�~|�vs�ur�sq�pn�qo�ol�ji�mj�qn�Z]CFL]_dLIN�aa�fb�ca�cb�a`�__�]^x_^�{x�ws�wt�sp�pn�po�lknZ^�lk�pmxXYDINkrwkUX�mj�db�fdX[�Y\�`_�]]�gi�vs�us�xu�tr�nk�lj�nk�jj�mk�kjlPR?CGGIP�bb�pm�fd�da�Y\�]]�b_�`_�ru�ml�ur�wu�tr�pk�lg�oi�oj�pl�kiaMO;@EPGI�kj�he�fd�fc�b`�a^�b`�_^
@@ -0,0 +1,27 @@
1
+ P1
2
+ 22 25
3
+ 1 1 1 1 1 1 1 0 1 0 0 0 0 0 0 1 1 1 1 1 1 1
4
+ 1 1 1 1 1 1 0 0 1 0 0 0 0 1 0 1 1 1 1 1 1 1
5
+ 1 1 1 1 1 1 0 0 0 0 0 0 1 0 1 0 1 1 1 1 1 0
6
+ 1 1 1 1 1 1 0 0 0 0 0 0 1 0 0 1 1 1 1 1 0 1
7
+ 1 1 1 1 1 1 1 1 1 1 1 0 1 0 0 1 1 1 1 1 1 0
8
+ 1 1 1 1 1 1 1 1 0 0 1 1 0 0 0 1 1 1 0 0 1 1
9
+ 1 1 1 1 1 1 0 0 0 1 1 1 1 0 0 1 1 1 1 1 0 1
10
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 0
11
+ 1 1 1 0 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
12
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 1 1 1 1 1 1 1
13
+ 1 1 1 1 1 1 1 1 1 1 1 1 1 1 0 0 1 1 1 0 0 0
14
+ 0 1 0 1 1 0 0 0 1 1 1 1 1 0 0 0 1 1 1 1 1 1
15
+ 1 0 0 0 1 1 0 0 0 1 1 1 1 1 0 1 1 1 1 1 0 1
16
+ 0 0 1 0 0 0 1 0 0 0 1 1 1 1 0 1 1 1 1 1 1 1
17
+ 0 0 0 0 0 0 0 1 0 0 0 0 1 0 0 1 1 1 0 1 1 0
18
+ 0 0 1 0 1 0 0 0 1 0 1 1 1 1 0 1 1 0 1 0 1 1
19
+ 1 0 0 1 0 1 0 0 1 0 0 1 1 1 0 1 1 1 0 1 1 0
20
+ 0 0 0 0 0 0 0 1 0 0 0 1 1 1 1 1 1 0 1 0 0 1
21
+ 1 0 1 1 0 1 0 1 0 1 0 1 1 1 1 1 0 1 1 1 0 1
22
+ 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 1 1 0 0 1 1 1
23
+ 1 0 0 1 1 0 1 0 0 1 0 1 1 1 1 1 1 0 0 1 1 1
24
+ 1 0 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 1 1 0 1
25
+ 1 0 0 0 0 1 0 1 1 0 1 1 1 1 1 0 1 0 1 1 1 1
26
+ 1 0 1 0 0 0 1 0 1 1 1 1 1 1 1 1 0 1 1 1 0 0
27
+ 1 0 0 1 0 0 1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 0
@@ -0,0 +1,28 @@
1
+ P2
2
+ 22 25
3
+ 255
4
+ 77 74 81 78 85 93 129 129 115 127 195 145 123 169 147 89 82 104 135 109 76 109
5
+ 71 74 77 105 107 112 132 169 122 151 204 114 95 97 117 101 65 76 105 133 114 88
6
+ 114 94 106 90 109 122 165 164 178 187 197 151 88 134 122 130 107 121 93 107 128 127
7
+ 158 104 82 82 85 92 144 155 154 180 157 183 87 182 145 96 108 80 65 84 127 126
8
+ 124 78 78 72 72 87 80 69 74 93 99 157 116 160 139 61 85 118 141 115 124 127
9
+ 86 74 76 72 71 64 100 121 139 170 132 142 154 182 160 90 77 94 142 145 118 124
10
+ 75 83 74 69 81 103 137 170 158 116 91 90 71 123 173 94 66 72 69 110 120 123
11
+ 77 92 72 106 138 140 104 84 78 66 68 71 69 96 161 103 71 90 76 81 125 121
12
+ 103 95 77 134 92 97 100 82 78 83 77 70 67 96 185 126 61 71 69 95 127 121
13
+ 122 80 82 105 112 66 66 87 106 96 76 68 74 84 180 130 75 83 95 110 126 119
14
+ 131 105 92 113 140 100 64 79 87 86 88 77 65 103 189 122 70 116 103 122 123 119
15
+ 138 138 128 106 127 158 128 90 69 71 85 105 81 93 191 115 68 95 114 119 121 120
16
+ 124 142 140 137 115 115 168 205 169 104 71 92 82 91 185 101 59 93 119 117 116 119
17
+ 131 140 140 138 140 131 117 132 146 166 148 115 68 106 192 99 83 109 123 118 116 118
18
+ 138 137 137 140 138 135 136 129 123 119 138 140 72 108 178 87 101 123 122 120 118 119
19
+ 136 132 136 135 134 135 134 134 128 133 126 123 90 105 177 84 101 123 121 120 119 118
20
+ 138 134 136 135 136 135 136 133 131 132 134 113 87 86 163 99 116 121 119 121 120 121
21
+ 137 134 133 133 135 137 137 134 137 136 138 114 77 103 147 81 122 121 119 120 121 122
22
+ 139 133 132 132 129 137 132 132 134 131 135 108 73 97 122 89 126 122 119 118 119 121
23
+ 137 137 134 135 133 133 134 133 132 126 129 103 75 79 111 95 127 121 120 118 119 119
24
+ 126 140 135 134 134 136 134 131 133 127 131 99 65 78 89 101 126 120 120 117 116 117
25
+ 112 143 135 134 133 130 132 129 119 127 133 99 70 95 74 113 123 119 120 118 116 115
26
+ 100 139 136 136 133 131 132 120 95 127 132 95 72 113 90 128 120 122 97 104 118 114
27
+ 109 133 135 137 134 128 127 127 123 128 126 86 66 73 108 131 122 119 101 111 119 117
28
+ 123 123 135 136 134 130 127 129 129 130 126 81 63 73 124 124 122 122 119 117 118 116
@@ -0,0 +1,28 @@
1
+ P3
2
+ 22 25
3
+ 255
4
+ 74 77 82 71 74 79 78 81 86 75 78 83 82 86 90 89 94 98 123 130 133 124 130 134 111 115 121 122 128 133 189 196 199 141 146 149 118 124 128 162 170 173 141 148 152 85 89 95 79 82 84 141 94 95 205 116 115 162 95 98 96 70 72 156 96 97
5
+ 68 71 76 72 74 80 74 77 81 102 106 110 102 108 112 108 113 117 125 133 136 161 171 173 117 123 128 144 152 157 197 206 209 110 115 119 91 96 100 93 98 103 113 118 125 97 101 106 62 65 70 76 76 79 139 96 99 205 114 111 173 98 100 120 79 82
6
+ 108 115 118 90 95 99 99 107 110 83 91 94 105 109 114 119 122 127 158 166 169 156 166 167 170 180 181 180 188 191 190 198 201 145 153 155 85 89 93 129 135 138 117 123 127 126 131 136 103 108 111 115 122 126 88 94 98 150 95 94 205 108 105 200 108 107
7
+ 151 159 162 100 105 109 79 82 87 79 82 87 82 85 90 89 92 97 138 145 148 149 156 160 149 155 159 175 181 185 150 159 162 176 184 188 85 87 92 177 183 185 139 146 149 93 96 101 104 109 113 79 80 85 62 65 72 102 79 82 199 108 106 198 107 106
8
+ 118 125 128 75 78 83 75 79 82 69 73 76 69 73 77 84 88 91 76 81 85 65 69 74 72 74 79 90 93 97 95 100 105 151 158 164 109 117 122 154 161 164 137 139 144 61 60 66 83 85 90 114 118 124 133 143 149 125 112 116 192 106 104 199 108 105
9
+ 80 87 90 71 74 79 73 77 80 69 73 76 68 72 75 61 65 69 96 101 105 117 122 126 134 140 143 166 171 175 125 133 137 135 143 149 148 155 161 176 183 189 156 160 167 88 90 95 77 77 82 91 94 101 135 143 149 144 145 147 179 101 100 199 104 101
10
+ 72 75 80 80 83 87 70 75 78 65 70 73 77 82 86 96 104 107 130 138 141 163 171 174 151 159 162 110 117 120 87 92 96 86 91 95 67 72 76 117 124 131 166 174 183 91 94 100 66 66 71 68 72 77 66 69 74 111 109 114 179 104 102 200 103 101
11
+ 74 77 83 90 92 97 68 73 76 101 107 110 131 139 142 136 141 145 100 105 109 80 85 89 77 78 83 66 66 71 67 68 73 70 71 76 68 69 74 93 96 102 153 163 167 99 104 108 68 71 76 84 92 94 69 77 81 93 77 81 194 106 105 196 101 99
12
+ 111 101 104 88 97 100 74 77 82 128 135 139 89 93 97 95 97 102 99 100 106 79 82 87 75 78 84 77 84 89 74 78 82 70 70 73 67 67 71 93 96 100 177 187 188 122 127 131 61 61 66 70 71 76 65 69 75 129 86 88 204 107 105 196 101 99
13
+ 164 110 114 76 81 87 78 83 90 100 106 109 107 113 116 66 66 72 65 66 71 80 88 93 94 108 116 83 99 103 73 77 80 67 68 72 74 74 78 81 84 88 172 182 185 127 131 135 74 75 80 80 83 88 95 94 100 167 95 95 203 106 102 193 99 97
14
+ 188 115 116 139 95 98 106 88 91 106 115 119 131 142 144 94 101 104 61 64 69 73 80 85 81 88 94 82 87 92 85 89 93 74 78 82 64 65 69 101 103 110 182 190 196 118 123 127 70 70 76 109 117 121 137 93 95 199 101 99 197 103 100 194 99 97
15
+ 200 122 120 199 122 120 188 112 111 132 99 103 126 127 131 151 159 164 121 129 132 89 90 94 67 69 73 69 71 75 83 85 90 101 106 110 77 82 85 90 93 98 184 193 198 111 115 120 65 68 73 109 91 95 184 95 96 195 99 97 195 101 99 195 100 98
16
+ 159 115 116 207 124 125 205 122 121 206 118 116 159 103 104 130 111 116 170 167 171 197 207 207 162 171 174 101 104 108 69 71 76 88 93 96 80 82 86 88 91 95 178 187 192 100 101 107 55 60 64 133 82 84 197 98 95 191 97 95 191 96 94 194 99 97
17
+ 183 117 120 204 123 126 202 124 122 202 121 118 206 123 119 194 114 112 163 105 105 152 127 129 156 143 146 162 167 170 140 150 154 110 116 119 68 68 73 103 106 110 184 194 199 96 99 106 83 83 87 163 94 94 200 103 100 192 98 96 191 96 94 193 98 96
18
+ 204 121 118 201 119 120 201 120 117 202 124 120 200 121 117 201 118 115 204 118 115 197 111 111 189 105 105 165 107 109 150 135 138 132 142 148 70 72 77 105 109 113 169 180 185 81 88 95 120 96 100 199 102 101 198 102 98 194 100 97 193 98 96 194 99 97
19
+ 201 119 117 200 114 112 201 118 116 202 117 115 201 116 114 201 118 115 200 116 115 203 115 114 189 112 111 194 117 118 189 109 108 133 120 124 86 91 95 103 105 110 170 179 183 79 85 91 140 90 92 203 102 99 195 101 97 195 100 98 194 99 97 192 98 96
20
+ 200 122 120 201 116 113 202 118 116 201 117 115 200 119 116 199 118 115 201 119 116 202 115 113 193 114 114 193 115 116 206 115 113 147 103 105 84 88 92 83 86 90 153 165 167 102 98 103 176 99 101 198 101 98 194 99 97 196 101 99 195 100 98 195 101 99
21
+ 199 121 117 200 117 114 200 115 113 200 115 114 200 118 115 200 120 117 200 120 115 200 116 113 201 120 116 200 119 115 206 120 116 150 105 104 75 77 82 99 104 109 138 149 154 93 78 80 193 103 101 197 101 98 194 99 97 195 100 98 196 101 99 196 102 100
22
+ 202 122 118 199 115 113 201 114 113 196 115 114 187 114 112 200 120 117 198 115 111 200 114 112 201 116 113 198 113 110 204 117 113 143 98 99 72 73 78 92 98 103 111 124 129 119 81 85 202 106 104 198 102 100 194 99 97 193 98 96 194 99 97 195 101 99
23
+ 195 122 121 202 120 116 201 116 114 200 118 115 198 115 114 201 115 114 200 116 113 200 115 112 201 114 112 198 107 106 203 109 107 137 94 94 72 76 80 76 79 84 102 113 118 133 85 86 204 106 102 196 101 99 195 100 98 194 98 96 195 99 98 194 99 97
24
+ 167 115 115 206 123 119 200 117 115 201 116 114 200 117 114 201 119 116 201 116 113 199 113 111 205 114 111 199 108 106 205 111 110 132 90 90 61 66 70 78 78 84 82 90 95 147 89 89 204 105 101 196 100 98 195 100 98 194 96 95 195 95 94 195 96 95
25
+ 137 105 106 208 126 124 200 118 115 199 117 114 201 115 113 199 112 110 201 113 111 196 111 108 166 106 105 193 109 106 207 113 110 130 90 93 67 70 76 93 95 100 76 73 78 170 97 97 201 102 98 195 99 97 197 99 98 194 97 96 195 95 95 194 93 94
26
+ 120 95 94 201 123 120 200 119 115 199 119 116 199 115 112 200 112 110 205 112 111 167 108 107 110 90 94 198 108 107 205 112 109 120 88 89 68 73 78 107 114 119 107 85 88 199 109 106 196 100 98 196 102 100 127 88 91 158 89 92 199 96 95 193 93 93
27
+ 132 103 105 188 118 115 201 117 115 200 120 117 200 116 114 198 110 107 199 108 106 189 110 107 188 106 106 200 109 107 198 107 106 108 80 82 63 67 71 71 73 80 146 98 98 204 112 109 198 102 100 190 100 97 144 89 92 176 93 93 196 98 95 194 96 95
28
+ 154 114 117 176 109 108 203 117 114 201 119 117 201 116 114 199 112 107 198 108 103 197 111 105 199 111 106 199 112 108 196 107 105 97 77 79 59 64 69 80 71 73 188 107 106 197 104 101 196 102 100 195 102 99 199 98 96 194 97 94 193 98 96 194 95 94
File without changes
File without changes
File without changes
File without changes
metadata CHANGED
@@ -1,104 +1,157 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_size
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.4.2
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keisuke Minami
8
8
  - Ivan Kuchin
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-02-18 00:00:00.000000000 Z
12
+ date: 2020-08-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - ~>
18
+ - - "~>"
19
19
  - !ruby/object:Gem::Version
20
20
  version: '3.0'
21
21
  type: :development
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - ~>
25
+ - - "~>"
26
26
  - !ruby/object:Gem::Version
27
27
  version: '3.0'
28
- description: ! 'Measure following file dimensions: bmp, cur, gif, jpeg, ico, pbm,
29
- pcx, pgm, png, ppm, psd, swf, tiff, xbm, xpm'
30
- email:
28
+ - !ruby/object:Gem::Dependency
29
+ name: rubocop
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - "~>"
33
+ - !ruby/object:Gem::Version
34
+ version: '0.59'
35
+ - - "!="
36
+ - !ruby/object:Gem::Version
37
+ version: 0.78.0
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ requirements:
42
+ - - "~>"
43
+ - !ruby/object:Gem::Version
44
+ version: '0.59'
45
+ - - "!="
46
+ - !ruby/object:Gem::Version
47
+ version: 0.78.0
48
+ description: 'Measure following file dimensions: apng, bmp, cur, gif, ico, j2c, jp2,
49
+ jpeg, jpx, mng, pam, pbm, pcx, pgm, png, ppm, psd, svg, swf, tiff, webp, xbm, xpm'
50
+ email:
31
51
  executables: []
32
52
  extensions: []
33
53
  extra_rdoc_files: []
34
54
  files:
35
- - .gitignore
36
- - .travis.yml
55
+ - ".gitignore"
56
+ - ".rubocop.yml"
57
+ - ".rubocop_todo.yml"
58
+ - ".travis.yml"
59
+ - CHANGELOG.markdown
37
60
  - Gemfile
38
61
  - README.markdown
39
62
  - image_size.gemspec
40
63
  - lib/image_size.rb
41
64
  - spec/image_size_spec.rb
42
- - spec/test.cur
43
- - spec/test.gif
44
- - spec/test.ico
45
- - spec/test.jpg
46
- - spec/test.pbm
47
- - spec/test.pcx
48
- - spec/test.pgm
49
- - spec/test.png
50
- - spec/test.psd
51
- - spec/test.svg
52
- - spec/test.swf
53
- - spec/test.tif
54
- - spec/test.xbm
55
- - spec/test.xpm
56
- - spec/test2.bmp
57
- - spec/test2.jpg
58
- - spec/test3b.bmp
59
- - spec/test3t.bmp
60
- homepage: http://github.com/toy/image_size
65
+ - spec/images/bmp/v2.42x50.bmp
66
+ - spec/images/bmp/v3-bottom2top.42x50.bmp
67
+ - spec/images/bmp/v3-top2bottom.42x50.bmp
68
+ - spec/images/cur/32x256.cur
69
+ - spec/images/gif/668x481.gif
70
+ - spec/images/ico/32x256.ico
71
+ - spec/images/jp2/163x402.jp2
72
+ - spec/images/jp2/176x373.jpx
73
+ - spec/images/jp2/224x293.j2c
74
+ - spec/images/jpeg/436x429.jpeg
75
+ - spec/images/jpeg/extraneous-bytes.436x429.jpeg
76
+ - spec/images/mng/61x42.mng
77
+ - spec/images/pcx/70x60.pcx
78
+ - spec/images/png/192x110.apng
79
+ - spec/images/png/640x532.png
80
+ - spec/images/pnm/22x25.pam
81
+ - spec/images/pnm/22x25.pbm
82
+ - spec/images/pnm/22x25.pgm
83
+ - spec/images/pnm/22x25.ppm
84
+ - spec/images/pnm/ascii.22x25.pbm
85
+ - spec/images/pnm/ascii.22x25.pgm
86
+ - spec/images/pnm/ascii.22x25.ppm
87
+ - spec/images/psd/16x20.psd
88
+ - spec/images/svg/72x100.svg
89
+ - spec/images/swf/450x200.swf
90
+ - spec/images/tiff/big-endian.68x49.tiff
91
+ - spec/images/tiff/little-endian.40x68.tiff
92
+ - spec/images/webp/extended.16x32.webp
93
+ - spec/images/webp/lossless.16x32.webp
94
+ - spec/images/webp/lossy.16x32.webp
95
+ - spec/images/xbm/16x32.xbm
96
+ - spec/images/xpm/24x32.xpm
97
+ homepage: https://github.com/toy/image_size
61
98
  licenses:
62
99
  - Ruby
63
- metadata: {}
64
- post_install_message:
100
+ metadata:
101
+ bug_tracker_uri: https://github.com/toy/image_size/issues
102
+ changelog_uri: https://github.com/toy/image_size/blob/master/CHANGELOG.markdown
103
+ documentation_uri: https://www.rubydoc.info/gems/image_size/2.1.0
104
+ source_code_uri: https://github.com/toy/image_size
105
+ post_install_message:
65
106
  rdoc_options: []
66
107
  require_paths:
67
108
  - lib
68
109
  required_ruby_version: !ruby/object:Gem::Requirement
69
110
  requirements:
70
- - - ! '>='
111
+ - - ">="
71
112
  - !ruby/object:Gem::Version
72
113
  version: '0'
73
114
  required_rubygems_version: !ruby/object:Gem::Requirement
74
115
  requirements:
75
- - - ! '>='
116
+ - - ">="
76
117
  - !ruby/object:Gem::Version
77
118
  version: '0'
78
119
  requirements: []
79
- rubyforge_project: image_size
80
- rubygems_version: 2.4.7
81
- signing_key:
120
+ rubygems_version: 3.1.4
121
+ signing_key:
82
122
  specification_version: 4
83
123
  summary: Measure image size using pure Ruby
84
124
  test_files:
85
125
  - spec/image_size_spec.rb
86
- - spec/test.cur
87
- - spec/test.gif
88
- - spec/test.ico
89
- - spec/test.jpg
90
- - spec/test.pbm
91
- - spec/test.pcx
92
- - spec/test.pgm
93
- - spec/test.png
94
- - spec/test.psd
95
- - spec/test.svg
96
- - spec/test.swf
97
- - spec/test.tif
98
- - spec/test.xbm
99
- - spec/test.xpm
100
- - spec/test2.bmp
101
- - spec/test2.jpg
102
- - spec/test3b.bmp
103
- - spec/test3t.bmp
104
- has_rdoc:
126
+ - spec/images/bmp/v2.42x50.bmp
127
+ - spec/images/bmp/v3-bottom2top.42x50.bmp
128
+ - spec/images/bmp/v3-top2bottom.42x50.bmp
129
+ - spec/images/cur/32x256.cur
130
+ - spec/images/gif/668x481.gif
131
+ - spec/images/ico/32x256.ico
132
+ - spec/images/jp2/163x402.jp2
133
+ - spec/images/jp2/176x373.jpx
134
+ - spec/images/jp2/224x293.j2c
135
+ - spec/images/jpeg/436x429.jpeg
136
+ - spec/images/jpeg/extraneous-bytes.436x429.jpeg
137
+ - spec/images/mng/61x42.mng
138
+ - spec/images/pcx/70x60.pcx
139
+ - spec/images/png/192x110.apng
140
+ - spec/images/png/640x532.png
141
+ - spec/images/pnm/22x25.pam
142
+ - spec/images/pnm/22x25.pbm
143
+ - spec/images/pnm/22x25.pgm
144
+ - spec/images/pnm/22x25.ppm
145
+ - spec/images/pnm/ascii.22x25.pbm
146
+ - spec/images/pnm/ascii.22x25.pgm
147
+ - spec/images/pnm/ascii.22x25.ppm
148
+ - spec/images/psd/16x20.psd
149
+ - spec/images/svg/72x100.svg
150
+ - spec/images/swf/450x200.swf
151
+ - spec/images/tiff/big-endian.68x49.tiff
152
+ - spec/images/tiff/little-endian.40x68.tiff
153
+ - spec/images/webp/extended.16x32.webp
154
+ - spec/images/webp/lossless.16x32.webp
155
+ - spec/images/webp/lossy.16x32.webp
156
+ - spec/images/xbm/16x32.xbm
157
+ - spec/images/xpm/24x32.xpm