image_size 1.1.4 → 1.1.5

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,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- NjNlM2Y5M2U0NTk4M2NjNGQ2MWM2OWZjYjVmMWJkODcxZTVhYjI4Mg==
4
+ OTQyNzA0NTJhM2ViNDFiOWM4ZjdhNDA4ZDVmMzgxZGEzOTg0ZWRmYw==
5
5
  data.tar.gz: !binary |-
6
- YjY0NTc4ZDRjNjkwNWFlZmM5NDk1NmIwYWFjYjI1YzkyOGU2N2Q5Mw==
6
+ ZWE2YmQ3ODVlYjI1NDM1NTgyYTA3ODFiNDY3ODYxN2VkNmUzNGY4MQ==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- Y2MzNzhhOWNhOTY5ZjM2NDk0MDE5MTUzNzkwNWYyZjVkYjEwNGQ1MThkMGYw
10
- OWY3MWRlMGY1ODgyMTk5MzRiNDExZDIyOWVkZjQzNjkxNGMyNGVlNzI3MGY0
11
- ODhjMzA1OTljNWQyYmYxM2JlODVjY2ZmNGM3YmY1NjM5ZjNhYzE=
9
+ OTQ3MjBiNDQxMTIyZWRkOWY1NjBmMjRhODM0OTUxY2JmNjBmZjY4NWQxNjgy
10
+ ZjcwNjBlNjU2MWFhNTBmYTY1MzM4NWVmMTZjMzIxZDlmNmVmZTg1ODVlMzJh
11
+ ZjE5Njg2NWFlNGY1NjIxMjAwMjY3NTA4NDdkMDU0NjNkNmViNGY=
12
12
  data.tar.gz: !binary |-
13
- YTY1NTEwZmZmYWQ2Njk5ZWUyZWU2OWEyODlmZDAwYWJhN2UzMWZmMTkyOTk2
14
- M2Y5YTE4N2YwZmIzNjQ5NzZlMzBmZGFjNTE0MmQwNTdlYzgyN2ZjODllZDdj
15
- NmQxYzYzZjBkYjAyOGI1MTAzMGVhM2UxMDk2YTYxMzRiMWFlZDQ=
13
+ YzVlMGU4OTdjN2M2NjNiMTk3OTQ4Mjc2ZDAyZWE5MWE1Mzc1ODBhZjgxODRh
14
+ NWQ5NmEyNjg0MjQ2MmQ2Y2Y0NDlhMTkzYzM2MGNhOTk4ODBlMTNkZjk1NTUy
15
+ ZDZjN2U1N2U3YzZhM2IxYzY5ZDk3YWQzZGRkYmFkNDRlN2JmMDc=
data/.travis.yml CHANGED
@@ -6,7 +6,5 @@ rvm:
6
6
  - 2.0.0
7
7
  - jruby-18mode
8
8
  - jruby-19mode
9
- - rbx-18mode
10
- - rbx-19mode
11
9
  - ree
12
10
  script: "bundle exec rspec"
data/image_size.gemspec CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'image_size'
5
- s.version = '1.1.4'
5
+ s.version = '1.1.5'
6
6
  s.summary = %q{Measure image size using pure Ruby}
7
7
  s.description = %q{Measure following file dimensions: bmp, gif, jpeg, pbm, pcx, pgm, png, ppm, psd, swf, tiff, xbm, xpm}
8
8
  s.homepage = "http://github.com/toy/#{s.name}"
data/lib/image_size.rb CHANGED
@@ -130,7 +130,18 @@ private
130
130
  end
131
131
 
132
132
  def size_of_bmp(ir)
133
- ir[18, 8].unpack('VV')
133
+ header_size = ir[14, 4].unpack('V')[0]
134
+ if header_size == 12
135
+ ir[18, 4].unpack('vv')
136
+ else
137
+ ir[18, 8].unpack('VV').map do |n|
138
+ if n > 0x7fff_ffff
139
+ 0x1_0000_0000 - n # absolute value of converted to signed
140
+ else
141
+ n
142
+ end
143
+ end
144
+ end
134
145
  end
135
146
 
136
147
  def size_of_ppm(ir)
@@ -161,7 +172,7 @@ private
161
172
  end
162
173
 
163
174
  def size_of_psd(ir)
164
- ir[14, 8].unpack('NN')
175
+ ir[14, 8].unpack('NN').reverse
165
176
  end
166
177
 
167
178
  def size_of_tiff(ir)
@@ -4,18 +4,20 @@ require 'image_size'
4
4
 
5
5
  describe ImageSize do
6
6
  [
7
- ['test.bmp', :bmp, 50, 50],
7
+ ['test2.bmp', :bmp, 42, 50],
8
+ ['test3b.bmp',:bmp, 42, 50],
9
+ ['test3t.bmp',:bmp, 42, 50],
8
10
  ['test.gif', :gif, 668, 481],
9
11
  ['test.jpg', :jpeg, 320, 240],
10
12
  ['test.pbm', :pbm, 85, 55],
11
13
  ['test.pcx', :pcx, 70, 60],
12
14
  ['test.pgm', :pgm, 90, 55],
13
15
  ['test.png', :png, 640, 532],
14
- ['test.psd', :psd, 20, 20],
16
+ ['test.psd', :psd, 16, 20],
15
17
  ['test.swf', :swf, 450, 200],
16
- ['test.tif', :tiff, 64, 64],
17
- ['test.xbm', :xbm, 16, 16],
18
- ['test.xpm', :xpm, 32, 32],
18
+ ['test.tif', :tiff, 48, 64],
19
+ ['test.xbm', :xbm, 16, 32],
20
+ ['test.xpm', :xpm, 24, 32],
19
21
  ['image_size_spec.rb', nil, nil, nil],
20
22
  ].each do |name, format, width, height|
21
23
  path = File.join(File.dirname(__FILE__), name)
data/spec/test.gif CHANGED
File without changes
data/spec/test.jpg CHANGED
File without changes
data/spec/test.pbm CHANGED
File without changes
data/spec/test.pcx CHANGED
File without changes
data/spec/test.pgm CHANGED
File without changes
data/spec/test.png CHANGED
File without changes
data/spec/test.psd CHANGED
Binary file
data/spec/test.swf CHANGED
File without changes
data/spec/test.tif CHANGED
Binary file
data/spec/test.xbm CHANGED
@@ -1,6 +1,11 @@
1
1
  #define cursor_width 16
2
- #define cursor_height 16
2
+ #define cursor_height 32
3
3
  static unsigned char cursor_bits[] = {
4
- 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x84, 0x10, 0xe8, 0x0b, 0x90, 0x04,
5
- 0xa8, 0x0a, 0x88, 0x08, 0xfe, 0x3f, 0x88, 0x08, 0xa8, 0x0a, 0x90, 0x04,
6
- 0xe8, 0x0b, 0x84, 0x10, 0x80, 0x00, 0x00, 0x00};
4
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
5
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
6
+ 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x84, 0x10,
7
+ 0xe8, 0x0b, 0x90, 0x04, 0xa8, 0x0a, 0x88, 0x08,
8
+ 0xfe, 0x3f, 0x88, 0x08, 0xa8, 0x0a, 0x90, 0x04,
9
+ 0xe8, 0x0b, 0x84, 0x10, 0x80, 0x00, 0x00, 0x00,
10
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
11
+ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
data/spec/test.xpm CHANGED
@@ -1,38 +1,40 @@
1
- /* XPM */
2
- static char * sample2_xpm[] = {
3
- "32 32 3 1",
4
- " c None",
5
- ". c #FFFFFF",
6
- "+ c #FF0000",
7
- "................................",
8
- "................................",
9
- "................................",
10
- "................................",
11
- "................................",
12
- "................................",
13
- "......++..................++....",
14
- "......+++................+++....",
15
- ".......+++..............+++.....",
16
- "........+++............+++......",
17
- ".........+++..........+++.......",
18
- "..........+++........+++........",
19
- "...........+++......+++.........",
20
- "............+++....+++..........",
21
- ".............+++..+++...........",
22
- "..............++++++............",
23
- "...............++++.............",
24
- "................+++.............",
25
- "...............+++++............",
26
- "..............+++.+++...........",
27
- ".............+++...+++..........",
28
- "............+++.....+++.........",
29
- "...........+++.......+++........",
30
- "..........+++.........+++.......",
31
- ".........+++...........+++......",
32
- "........+++.............+++.....",
33
- ".......+++...............+++....",
34
- "......+++.................+++...",
35
- "......++...................++...",
36
- "................................",
37
- "................................",
38
- "................................"};
1
+ /* XPM */
2
+ static char *test2[] = {
3
+ /* columns rows colors chars-per-pixel */
4
+ "24 32 2 1 ",
5
+ " c red",
6
+ ". c white",
7
+ /* pixels */
8
+ "........................",
9
+ "........................",
10
+ "........................",
11
+ "........................",
12
+ "........................",
13
+ "........................",
14
+ ".. .................. ",
15
+ ".. ................ ",
16
+ "... .............. .",
17
+ ".... ............ ..",
18
+ "..... .......... ...",
19
+ "...... ........ ....",
20
+ "....... ...... .....",
21
+ "........ .... ......",
22
+ "......... .. .......",
23
+ ".......... ........",
24
+ "........... .........",
25
+ "............ .........",
26
+ "........... ........",
27
+ ".......... . .......",
28
+ "......... ... ......",
29
+ "........ ..... .....",
30
+ "....... ....... ....",
31
+ "...... ......... ...",
32
+ "..... ........... ..",
33
+ ".... ............. .",
34
+ "... ............... ",
35
+ ".. ................. ",
36
+ ".. ................... ",
37
+ "........................",
38
+ "........................",
39
+ "........................"
40
+ };
data/spec/test2.bmp ADDED
Binary file
data/spec/test3b.bmp ADDED
Binary file
data/spec/test3t.bmp ADDED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: image_size
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.4
4
+ version: 1.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keisuke Minami
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-11-04 00:00:00.000000000 Z
12
+ date: 2013-12-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -39,7 +39,6 @@ files:
39
39
  - image_size.gemspec
40
40
  - lib/image_size.rb
41
41
  - spec/image_size_spec.rb
42
- - spec/test.bmp
43
42
  - spec/test.gif
44
43
  - spec/test.jpg
45
44
  - spec/test.pbm
@@ -51,6 +50,9 @@ files:
51
50
  - spec/test.tif
52
51
  - spec/test.xbm
53
52
  - spec/test.xpm
53
+ - spec/test2.bmp
54
+ - spec/test3b.bmp
55
+ - spec/test3t.bmp
54
56
  homepage: http://github.com/toy/image_size
55
57
  licenses:
56
58
  - MIT
@@ -77,7 +79,6 @@ specification_version: 4
77
79
  summary: Measure image size using pure Ruby
78
80
  test_files:
79
81
  - spec/image_size_spec.rb
80
- - spec/test.bmp
81
82
  - spec/test.gif
82
83
  - spec/test.jpg
83
84
  - spec/test.pbm
@@ -89,3 +90,6 @@ test_files:
89
90
  - spec/test.tif
90
91
  - spec/test.xbm
91
92
  - spec/test.xpm
93
+ - spec/test2.bmp
94
+ - spec/test3b.bmp
95
+ - spec/test3t.bmp
data/spec/test.bmp DELETED
Binary file