gif-info 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- checksums.yaml.gz.sig +2 -0
- data.tar.gz.sig +0 -0
- data/CHANGES.txt +9 -0
- data/LICENSE.txt +1 -1
- data/README.md +6 -16
- data/bin/gif-info +2 -0
- data/lib/gif-info.rb +16 -2
- data/lib/gif-info/block.rb +0 -0
- data/lib/gif-info/blocks/application-extension.rb +0 -0
- data/lib/gif-info/blocks/comment-extension.rb +0 -0
- data/lib/gif-info/blocks/global-color-table.rb +0 -0
- data/lib/gif-info/blocks/graphics-control-extension.rb +0 -0
- data/lib/gif-info/blocks/header-block.rb +0 -0
- data/lib/gif-info/blocks/image-data.rb +0 -0
- data/lib/gif-info/blocks/image-descriptor.rb +0 -0
- data/lib/gif-info/blocks/local-color-table.rb +0 -0
- data/lib/gif-info/blocks/logical-screen-descriptor.rb +0 -0
- data/lib/gif-info/blocks/plain-text-extension.rb +0 -0
- data/lib/gif-info/blocks/trailer.rb +0 -0
- data/lib/gif-info/body.rb +0 -0
- data/lib/gif-info/color-table.rb +0 -0
- data/lib/gif-info/data-block.rb +0 -0
- data/lib/gif-info/dynamic-block.rb +0 -0
- data/lib/gif-info/fixed-block.rb +0 -0
- data/lib/gif-info/raw-block.rb +0 -0
- metadata +102 -90
- metadata.gz.sig +1 -0
- data/.document +0 -5
- data/Gemfile +0 -14
- data/Gemfile.lock +0 -33
- data/Rakefile +0 -37
- data/VERSION +0 -1
- data/ajax-loader-0.gif +0 -0
- data/ajax-loader.gif +0 -0
- data/gif-info.gemspec +0 -86
- data/test +0 -112
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 091be1477c8e40423020e805d3b5f94b19da3966
|
4
|
+
data.tar.gz: ecc306a23954b14ef66a1bd0cd26b5f3f69f38a7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 100f18e622112387d9a1d0ba431dafdb3dfe9890cb2d43568ab1c93fe4507f6897fd91ea8115ed803478f7cdca408d98f250a61864905ce1282cb18195bacd68
|
7
|
+
data.tar.gz: c667363a1311ad7454627ad86d3dd2167517a8277f272f6c26b023c35e9aa3c47cc64af2b69a06ffd9a3c2f869dbdac057cec4135a97c9b306c8fbadfa031a77
|
checksums.yaml.gz.sig
ADDED
data.tar.gz.sig
ADDED
Binary file
|
data/CHANGES.txt
ADDED
@@ -0,0 +1,9 @@
|
|
1
|
+
|
2
|
+
0.1.1 (2016-02-05)
|
3
|
+
* added duration calcultaion for animated GIFs [Oded Arbel]
|
4
|
+
* added duration support to 'gif-info' command [Martin Poljak]
|
5
|
+
* bug in local color table extraction fixed [Oded Arbel]
|
6
|
+
* jeweler deprecated, gem signed [Martin Poljak]
|
7
|
+
|
8
|
+
0.1.0 (2011-03-10)
|
9
|
+
* initial version [Martin Poljak]
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -27,26 +27,16 @@ of data blocks as comments or image data -- it's necessary split them
|
|
27
27
|
to blocks manually in your writing routine. Other structures provided
|
28
28
|
by the library contains binary serialization routines implicitly.
|
29
29
|
|
30
|
-
Contributing
|
31
|
-
------------
|
32
|
-
|
33
|
-
1. Fork it.
|
34
|
-
2. Create a branch (`git checkout -b 20101220-my-change`).
|
35
|
-
3. Commit your changes (`git commit -am "Added something"`).
|
36
|
-
4. Push to the branch (`git push origin 20101220-my-change`).
|
37
|
-
5. Create an [Issue][6] with a link to your branch.
|
38
|
-
6. Enjoy a refreshing Diet Coke and wait.
|
39
|
-
|
40
30
|
Copyright
|
41
31
|
---------
|
42
32
|
|
43
|
-
Copyright © 2011 [Martin
|
33
|
+
Copyright © 2011 - 2016 [Martin Poljak][7]. See `LICENSE.txt` for
|
44
34
|
further details.
|
45
35
|
|
46
36
|
[1]: http://www.matthewflickinger.com/lab/whatsinagif/
|
47
|
-
[2]:
|
48
|
-
[3]:
|
49
|
-
[4]:
|
37
|
+
[2]: https://en.wikipedia.org/wiki/LZW
|
38
|
+
[3]: https://en.wikipedia.org/wiki/Simple_API_for_XML
|
39
|
+
[4]: https://en.wikipedia.org/wiki/Document_Object_Model
|
50
40
|
[5]: https://github.com/martinkozak/struct-fx
|
51
|
-
[6]:
|
52
|
-
[7]:
|
41
|
+
[6]: https://github.com/martinkozak/gif-info/issues
|
42
|
+
[7]: https://www.martinpoljak.net/
|
data/bin/gif-info
CHANGED
@@ -29,6 +29,8 @@ puts "images_count " << f.images_count.to_s
|
|
29
29
|
puts "width " << f.width.to_s
|
30
30
|
puts "height " << f.height.to_s
|
31
31
|
puts "color_resolution " << f.color_resolution.to_s
|
32
|
+
puts "duration " << f.duration.to_s
|
33
|
+
|
32
34
|
|
33
35
|
if not f.pixel_aspect_ratio.nil?
|
34
36
|
puts "pixel_aspect_ratio " << f.pixel_aspect_ratio.to_s
|
data/lib/gif-info.rb
CHANGED
@@ -125,8 +125,8 @@ class GifInfo
|
|
125
125
|
yield desc = Blocks::ImageDescriptor::new(io)
|
126
126
|
|
127
127
|
# Local Color Table
|
128
|
-
if desc.header.data.packed.data.local_color_table
|
129
|
-
size =
|
128
|
+
if (d = desc.header.data.packed.data).local_color_table
|
129
|
+
size = d.local_color_table_size
|
130
130
|
yield Blocks::LocalColorTable::new(io, size)
|
131
131
|
end
|
132
132
|
|
@@ -256,6 +256,18 @@ class GifInfo
|
|
256
256
|
attr_reader :images_count
|
257
257
|
@images_count
|
258
258
|
|
259
|
+
##
|
260
|
+
# Contains the GIF duration, for multiple image files. In animaged GIF
|
261
|
+
# files, frames specify a delay from one another, and the duration of
|
262
|
+
# animation is the total of all the frame delays. A nonanimaged GIF
|
263
|
+
# hence has a duration of 0.
|
264
|
+
#
|
265
|
+
# @return [Float] duration in seconds
|
266
|
+
#
|
267
|
+
|
268
|
+
attr_reader :duration
|
269
|
+
@duration
|
270
|
+
|
259
271
|
##
|
260
272
|
# Indicates animation is cyclic.
|
261
273
|
#
|
@@ -292,6 +304,7 @@ class GifInfo
|
|
292
304
|
@animated = false
|
293
305
|
@transparent = false
|
294
306
|
@interlaced = false
|
307
|
+
@duration = 0
|
295
308
|
|
296
309
|
self.consider! io
|
297
310
|
end
|
@@ -353,6 +366,7 @@ class GifInfo
|
|
353
366
|
elsif block.kind_of? GifInfo::Blocks::GraphicsControlExtension
|
354
367
|
packed = block.header.data.packed.data
|
355
368
|
@transparent |= packed.transparent_color # transparent
|
369
|
+
@duration += block.header.data.delay_time.to_f / 100 # delay time is in hundredths of a second
|
356
370
|
|
357
371
|
end
|
358
372
|
|
data/lib/gif-info/block.rb
CHANGED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
data/lib/gif-info/body.rb
CHANGED
File without changes
|
data/lib/gif-info/color-table.rb
CHANGED
File without changes
|
data/lib/gif-info/data-block.rb
CHANGED
File without changes
|
File without changes
|
data/lib/gif-info/fixed-block.rb
CHANGED
File without changes
|
data/lib/gif-info/raw-block.rb
CHANGED
File without changes
|
metadata
CHANGED
@@ -1,107 +1,123 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: gif-info
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
version: 0.1.0
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.1
|
6
5
|
platform: ruby
|
7
|
-
authors:
|
8
|
-
-
|
6
|
+
authors:
|
7
|
+
- Martin Poljak
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
|
-
cert_chain:
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
cert_chain:
|
11
|
+
- |
|
12
|
+
-----BEGIN CERTIFICATE-----
|
13
|
+
MIIDaDCCAlCgAwIBAgIBATANBgkqhkiG9w0BAQUFADA9MQ8wDQYDVQQDDAZtYXJ0
|
14
|
+
aW4xFjAUBgoJkiaJk/IsZAEZFgZwb2xqYWsxEjAQBgoJkiaJk/IsZAEZFgJjejAe
|
15
|
+
Fw0xNjAyMDUxMzE3NDZaFw0xNzAyMDQxMzE3NDZaMD0xDzANBgNVBAMMBm1hcnRp
|
16
|
+
bjEWMBQGCgmSJomT8ixkARkWBnBvbGphazESMBAGCgmSJomT8ixkARkWAmN6MIIB
|
17
|
+
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAtCef4FeYcG36rjDxQy0yDWca
|
18
|
+
wUEYewtq3i3MiSu2MphVBA/yqQmX8EPbBKYWw7N2AKtsi7oYBG9unTaaGuyzpR1+
|
19
|
+
gtss4yEN2s7I5yHfXsUey/Nsn7jGNJTp+J1sb3jNbBMVzp+l0S1MGWo4y2kC+Ukq
|
20
|
+
ZXuTit2qC/CLZLZWUqI0+I/T8G3UlHV2drCKOnK+4GjAbJuQEO/o7JgCVHUfq3UO
|
21
|
+
nLrRQlwdxFScmxCrir4y6sIFD1VlkVEb/ShOd2tRONJmjTNrljQ28P2ZyI2kWq8d
|
22
|
+
6cSNA69BZTn7O8foFGZ+dn4qo88vZy2P6IXwvlO7+r9iodEVmjiNl9wRTKAZ8QID
|
23
|
+
AQABo3MwcTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNVHQ4EFgQUtORppfJu
|
24
|
+
tmr/37fd2mHW1EivPywwGwYDVR0RBBQwEoEQbWFydGluQHBvbGphay5jejAbBgNV
|
25
|
+
HRIEFDASgRBtYXJ0aW5AcG9samFrLmN6MA0GCSqGSIb3DQEBBQUAA4IBAQAzkQWl
|
26
|
+
/9cnBPAM59hO5HaycL9ZqzXiG4cBtFCrhwKI9VRS/DqB0RUXL32YhCjrozZe8Y4D
|
27
|
+
MDWGtU+6ipSh7qiAesmAa/HBNwm2bBswldTAUS7vcdiX22buaDW5T+9LbNAwE2N/
|
28
|
+
Sw9AusJ4w2dtoQGpFOHRhERftKZMudRER+rmz7wdL7TDZkm9SSBI4tkpJBUMmBi3
|
29
|
+
kFsp/cni5lY7gPq95G673iQKjyqpcB4jSVTRD6urDLDeowGQUulmhjXO7j9jSRQV
|
30
|
+
KgC9oMVpfOtlri8yPY9gxvbd2z+ksYuOzjK+W43iPeZP6CPOyTOoutbT5a6HXla1
|
31
|
+
k53ffC3Dt8MEpdxF
|
32
|
+
-----END CERTIFICATE-----
|
33
|
+
date: 2016-02-05 00:00:00.000000000 Z
|
34
|
+
dependencies:
|
35
|
+
- !ruby/object:Gem::Dependency
|
17
36
|
name: struct-fx
|
18
|
-
requirement:
|
19
|
-
|
20
|
-
requirements:
|
37
|
+
requirement: !ruby/object:Gem::Requirement
|
38
|
+
requirements:
|
21
39
|
- - ">="
|
22
|
-
- !ruby/object:Gem::Version
|
40
|
+
- !ruby/object:Gem::Version
|
23
41
|
version: 0.1.1
|
24
42
|
type: :runtime
|
25
43
|
prerelease: false
|
26
|
-
version_requirements:
|
27
|
-
|
44
|
+
version_requirements: !ruby/object:Gem::Requirement
|
45
|
+
requirements:
|
46
|
+
- - ">="
|
47
|
+
- !ruby/object:Gem::Version
|
48
|
+
version: 0.1.1
|
49
|
+
- !ruby/object:Gem::Dependency
|
28
50
|
name: abstract
|
29
|
-
requirement:
|
30
|
-
|
31
|
-
requirements:
|
51
|
+
requirement: !ruby/object:Gem::Requirement
|
52
|
+
requirements:
|
32
53
|
- - ">="
|
33
|
-
- !ruby/object:Gem::Version
|
54
|
+
- !ruby/object:Gem::Version
|
34
55
|
version: 1.0.0
|
35
56
|
type: :runtime
|
36
57
|
prerelease: false
|
37
|
-
version_requirements:
|
38
|
-
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
requirements:
|
60
|
+
- - ">="
|
61
|
+
- !ruby/object:Gem::Version
|
62
|
+
version: 1.0.0
|
63
|
+
- !ruby/object:Gem::Dependency
|
39
64
|
name: frozen-objects
|
40
|
-
requirement:
|
41
|
-
|
42
|
-
requirements:
|
65
|
+
requirement: !ruby/object:Gem::Requirement
|
66
|
+
requirements:
|
43
67
|
- - ">="
|
44
|
-
- !ruby/object:Gem::Version
|
68
|
+
- !ruby/object:Gem::Version
|
45
69
|
version: 0.2.0
|
46
70
|
type: :runtime
|
47
71
|
prerelease: false
|
48
|
-
version_requirements:
|
49
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: 0.2.0
|
77
|
+
- !ruby/object:Gem::Dependency
|
50
78
|
name: bundler
|
51
|
-
requirement:
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
- !ruby/object:Gem::Version
|
79
|
+
requirement: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
56
83
|
version: 1.0.0
|
57
84
|
type: :development
|
58
85
|
prerelease: false
|
59
|
-
version_requirements:
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
- - ~>
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: 1.5.2
|
68
|
-
type: :development
|
69
|
-
prerelease: false
|
70
|
-
version_requirements: *id005
|
71
|
-
- !ruby/object:Gem::Dependency
|
86
|
+
version_requirements: !ruby/object:Gem::Requirement
|
87
|
+
requirements:
|
88
|
+
- - "~>"
|
89
|
+
- !ruby/object:Gem::Version
|
90
|
+
version: 1.0.0
|
91
|
+
- !ruby/object:Gem::Dependency
|
72
92
|
name: riot
|
73
|
-
requirement:
|
74
|
-
|
75
|
-
requirements:
|
93
|
+
requirement: !ruby/object:Gem::Requirement
|
94
|
+
requirements:
|
76
95
|
- - ">="
|
77
|
-
- !ruby/object:Gem::Version
|
96
|
+
- !ruby/object:Gem::Version
|
78
97
|
version: 0.12.1
|
79
98
|
type: :development
|
80
99
|
prerelease: false
|
81
|
-
version_requirements:
|
100
|
+
version_requirements: !ruby/object:Gem::Requirement
|
101
|
+
requirements:
|
102
|
+
- - ">="
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: 0.12.1
|
82
105
|
description:
|
83
|
-
email:
|
84
|
-
executables:
|
106
|
+
email: martin@poljak.cz
|
107
|
+
executables:
|
85
108
|
- gif-dump
|
86
109
|
- gif-info
|
87
110
|
extensions: []
|
88
|
-
|
89
|
-
extra_rdoc_files:
|
111
|
+
extra_rdoc_files:
|
90
112
|
- LICENSE.txt
|
91
113
|
- README.md
|
92
|
-
|
93
|
-
|
94
|
-
-
|
95
|
-
- Gemfile.lock
|
114
|
+
- CHANGES.txt
|
115
|
+
files:
|
116
|
+
- CHANGES.txt
|
96
117
|
- LICENSE.txt
|
97
118
|
- README.md
|
98
|
-
- Rakefile
|
99
|
-
- VERSION
|
100
|
-
- ajax-loader-0.gif
|
101
|
-
- ajax-loader.gif
|
102
119
|
- bin/gif-dump
|
103
120
|
- bin/gif-info
|
104
|
-
- gif-info.gemspec
|
105
121
|
- lib/gif-info.rb
|
106
122
|
- lib/gif-info/block.rb
|
107
123
|
- lib/gif-info/blocks/application-extension.rb
|
@@ -121,37 +137,33 @@ files:
|
|
121
137
|
- lib/gif-info/dynamic-block.rb
|
122
138
|
- lib/gif-info/fixed-block.rb
|
123
139
|
- lib/gif-info/raw-block.rb
|
124
|
-
-
|
125
|
-
|
126
|
-
homepage: http://github.com/martinkozak/gif-info
|
127
|
-
licenses:
|
140
|
+
homepage: https://github.com/martinkozak/gif-info
|
141
|
+
licenses:
|
128
142
|
- MIT
|
143
|
+
metadata: {}
|
129
144
|
post_install_message:
|
130
145
|
rdoc_options: []
|
131
|
-
|
132
|
-
require_paths:
|
146
|
+
require_paths:
|
133
147
|
- lib
|
134
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
-
|
136
|
-
requirements:
|
148
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
137
150
|
- - ">="
|
138
|
-
- !ruby/object:Gem::Version
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
version: "0"
|
143
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
144
|
-
none: false
|
145
|
-
requirements:
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
146
155
|
- - ">="
|
147
|
-
- !ruby/object:Gem::Version
|
148
|
-
version:
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: '0'
|
149
158
|
requirements: []
|
150
|
-
|
151
159
|
rubyforge_project:
|
152
|
-
rubygems_version:
|
160
|
+
rubygems_version: 2.5.1
|
153
161
|
signing_key:
|
154
|
-
specification_version:
|
155
|
-
summary: Pure Ruby analyzer of the GIF image format. Performs complete analysis of
|
162
|
+
specification_version: 4
|
163
|
+
summary: Pure Ruby analyzer of the GIF image format. Performs complete analysis of
|
164
|
+
internal GIF block structure and streams it as an objects stream with metainformations
|
165
|
+
of each block. Also can interpret internal structure by providing the simple object-like
|
166
|
+
interface to base image file informations. Works above seekable IO streams, so allows
|
167
|
+
processing of the big files too. Doesn't perform LZW decompressing, returns raw
|
168
|
+
data for both color tables and images.
|
156
169
|
test_files: []
|
157
|
-
|
metadata.gz.sig
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
|E2i��@���W���F�jԶ(I5?A�����_�u�����U/�Nj�bgz���۷�o�ó�M�v����M��Jgl%�K� [zE�& �4~�̜;GO��%8nc(�8{ܗ�U��1NI�o4�
|
data/.document
DELETED
data/Gemfile
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
source "http://rubygems.org"
|
2
|
-
# Add dependencies required to use your gem here.
|
3
|
-
# Example:
|
4
|
-
gem "struct-fx", ">= 0.1.1"
|
5
|
-
gem "abstract", ">= 1.0.0"
|
6
|
-
gem "frozen-objects", ">= 0.2.0"
|
7
|
-
|
8
|
-
# Add dependencies to develop your gem here.
|
9
|
-
# Include everything needed to run rake, tests, features, etc.
|
10
|
-
group :development do
|
11
|
-
gem "bundler", "~> 1.0.0"
|
12
|
-
gem "jeweler", "~> 1.5.2"
|
13
|
-
gem "riot", ">= 0.12.1"
|
14
|
-
end
|
data/Gemfile.lock
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: http://rubygems.org/
|
3
|
-
specs:
|
4
|
-
abstract (1.0.0)
|
5
|
-
bit-packer (0.1.0)
|
6
|
-
lookup-hash (>= 0.2.0)
|
7
|
-
frozen-objects (0.2.0)
|
8
|
-
git (1.2.5)
|
9
|
-
hash-utils (0.11.0)
|
10
|
-
jeweler (1.5.2)
|
11
|
-
bundler (~> 1.0.0)
|
12
|
-
git (>= 1.2.5)
|
13
|
-
rake
|
14
|
-
lookup-hash (0.2.0)
|
15
|
-
hash-utils (>= 0.11.0)
|
16
|
-
rake (0.8.7)
|
17
|
-
riot (0.12.2)
|
18
|
-
rr
|
19
|
-
rr (1.0.2)
|
20
|
-
struct-fx (0.1.1)
|
21
|
-
bit-packer (>= 0.1.0)
|
22
|
-
frozen-objects (>= 0.2.0)
|
23
|
-
|
24
|
-
PLATFORMS
|
25
|
-
ruby
|
26
|
-
|
27
|
-
DEPENDENCIES
|
28
|
-
abstract (>= 1.0.0)
|
29
|
-
bundler (~> 1.0.0)
|
30
|
-
frozen-objects (>= 0.2.0)
|
31
|
-
jeweler (~> 1.5.2)
|
32
|
-
riot (>= 0.12.1)
|
33
|
-
struct-fx (>= 0.1.1)
|
data/Rakefile
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
# encoding: utf-8
|
2
|
-
require 'rubygems'
|
3
|
-
require 'bundler'
|
4
|
-
begin
|
5
|
-
Bundler.setup(:default, :development)
|
6
|
-
rescue Bundler::BundlerError => e
|
7
|
-
$stderr.puts e.message
|
8
|
-
$stderr.puts "Run `bundle install` to install missing gems"
|
9
|
-
exit e.status_code
|
10
|
-
end
|
11
|
-
require 'rake'
|
12
|
-
|
13
|
-
require 'jeweler'
|
14
|
-
Jeweler::Tasks.new do |gem|
|
15
|
-
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
16
|
-
gem.name = "gif-info"
|
17
|
-
gem.homepage = "http://github.com/martinkozak/gif-info"
|
18
|
-
gem.license = "MIT"
|
19
|
-
gem.summary = 'Pure Ruby analyzer of the GIF image format. Performs complete analysis of internal GIF block structure and streams it as an objects stream with metainformations of each block. Also can interpret internal structure by providing the simple object-like interface to base image file informations. Works above seekable IO streams, so allows processing of the big files too. Doesn\'t perform LZW decompressing, returns raw data for both color tables and images.'
|
20
|
-
gem.email = "martinkozak@martinkozak.net"
|
21
|
-
gem.authors = ["Martin Kozák"]
|
22
|
-
# Include your dependencies below. Runtime dependencies are required when using your gem,
|
23
|
-
# and development dependencies are only needed for development (ie running rake tasks, tests, etc)
|
24
|
-
# gem.add_runtime_dependency 'jabber4r', '> 0.1'
|
25
|
-
# gem.add_development_dependency 'rspec', '> 1.2.3'
|
26
|
-
end
|
27
|
-
Jeweler::RubygemsDotOrgTasks.new
|
28
|
-
|
29
|
-
require 'rake/rdoctask'
|
30
|
-
Rake::RDocTask.new do |rdoc|
|
31
|
-
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
32
|
-
|
33
|
-
rdoc.rdoc_dir = 'rdoc'
|
34
|
-
rdoc.title = "hash-utils #{version}"
|
35
|
-
rdoc.rdoc_files.include('README*')
|
36
|
-
rdoc.rdoc_files.include('lib/**/*.rb')
|
37
|
-
end
|
data/VERSION
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
0.1.0
|
data/ajax-loader-0.gif
DELETED
Binary file
|
data/ajax-loader.gif
DELETED
Binary file
|
data/gif-info.gemspec
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
# Generated by jeweler
|
2
|
-
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
-
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
-
# -*- encoding: utf-8 -*-
|
5
|
-
|
6
|
-
Gem::Specification.new do |s|
|
7
|
-
s.name = %q{gif-info}
|
8
|
-
s.version = "0.1.0"
|
9
|
-
|
10
|
-
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
-
s.authors = ["Martin Kozák"]
|
12
|
-
s.date = %q{2011-03-10}
|
13
|
-
s.email = %q{martinkozak@martinkozak.net}
|
14
|
-
s.executables = ["gif-dump", "gif-info"]
|
15
|
-
s.extra_rdoc_files = [
|
16
|
-
"LICENSE.txt",
|
17
|
-
"README.md"
|
18
|
-
]
|
19
|
-
s.files = [
|
20
|
-
".document",
|
21
|
-
"Gemfile",
|
22
|
-
"Gemfile.lock",
|
23
|
-
"LICENSE.txt",
|
24
|
-
"README.md",
|
25
|
-
"Rakefile",
|
26
|
-
"VERSION",
|
27
|
-
"ajax-loader-0.gif",
|
28
|
-
"ajax-loader.gif",
|
29
|
-
"bin/gif-dump",
|
30
|
-
"bin/gif-info",
|
31
|
-
"gif-info.gemspec",
|
32
|
-
"lib/gif-info.rb",
|
33
|
-
"lib/gif-info/block.rb",
|
34
|
-
"lib/gif-info/blocks/application-extension.rb",
|
35
|
-
"lib/gif-info/blocks/comment-extension.rb",
|
36
|
-
"lib/gif-info/blocks/global-color-table.rb",
|
37
|
-
"lib/gif-info/blocks/graphics-control-extension.rb",
|
38
|
-
"lib/gif-info/blocks/header-block.rb",
|
39
|
-
"lib/gif-info/blocks/image-data.rb",
|
40
|
-
"lib/gif-info/blocks/image-descriptor.rb",
|
41
|
-
"lib/gif-info/blocks/local-color-table.rb",
|
42
|
-
"lib/gif-info/blocks/logical-screen-descriptor.rb",
|
43
|
-
"lib/gif-info/blocks/plain-text-extension.rb",
|
44
|
-
"lib/gif-info/blocks/trailer.rb",
|
45
|
-
"lib/gif-info/body.rb",
|
46
|
-
"lib/gif-info/color-table.rb",
|
47
|
-
"lib/gif-info/data-block.rb",
|
48
|
-
"lib/gif-info/dynamic-block.rb",
|
49
|
-
"lib/gif-info/fixed-block.rb",
|
50
|
-
"lib/gif-info/raw-block.rb",
|
51
|
-
"test"
|
52
|
-
]
|
53
|
-
s.homepage = %q{http://github.com/martinkozak/gif-info}
|
54
|
-
s.licenses = ["MIT"]
|
55
|
-
s.require_paths = ["lib"]
|
56
|
-
s.rubygems_version = %q{1.6.2}
|
57
|
-
s.summary = %q{Pure Ruby analyzer of the GIF image format. Performs complete analysis of internal GIF block structure and streams it as an objects stream with metainformations of each block. Also can interpret internal structure by providing the simple object-like interface to base image file informations. Works above seekable IO streams, so allows processing of the big files too. Doesn't perform LZW decompressing, returns raw data for both color tables and images.}
|
58
|
-
|
59
|
-
if s.respond_to? :specification_version then
|
60
|
-
s.specification_version = 3
|
61
|
-
|
62
|
-
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
63
|
-
s.add_runtime_dependency(%q<struct-fx>, [">= 0.1.1"])
|
64
|
-
s.add_runtime_dependency(%q<abstract>, [">= 1.0.0"])
|
65
|
-
s.add_runtime_dependency(%q<frozen-objects>, [">= 0.2.0"])
|
66
|
-
s.add_development_dependency(%q<bundler>, ["~> 1.0.0"])
|
67
|
-
s.add_development_dependency(%q<jeweler>, ["~> 1.5.2"])
|
68
|
-
s.add_development_dependency(%q<riot>, [">= 0.12.1"])
|
69
|
-
else
|
70
|
-
s.add_dependency(%q<struct-fx>, [">= 0.1.1"])
|
71
|
-
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
72
|
-
s.add_dependency(%q<frozen-objects>, [">= 0.2.0"])
|
73
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
74
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
75
|
-
s.add_dependency(%q<riot>, [">= 0.12.1"])
|
76
|
-
end
|
77
|
-
else
|
78
|
-
s.add_dependency(%q<struct-fx>, [">= 0.1.1"])
|
79
|
-
s.add_dependency(%q<abstract>, [">= 1.0.0"])
|
80
|
-
s.add_dependency(%q<frozen-objects>, [">= 0.2.0"])
|
81
|
-
s.add_dependency(%q<bundler>, ["~> 1.0.0"])
|
82
|
-
s.add_dependency(%q<jeweler>, ["~> 1.5.2"])
|
83
|
-
s.add_dependency(%q<riot>, [">= 0.12.1"])
|
84
|
-
end
|
85
|
-
end
|
86
|
-
|
data/test
DELETED
@@ -1,112 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
# encoding: utf-8
|
3
|
-
# (c) 2011 Martin Kozák (martinkozak@martinkozak.net)
|
4
|
-
|
5
|
-
$:.push("./lib")
|
6
|
-
require "gif-info"
|
7
|
-
require "riot"
|
8
|
-
require "digest/md5"
|
9
|
-
|
10
|
-
context "GifInfo (animated, base informations)" do
|
11
|
-
setup do
|
12
|
-
GifInfo::analyze_file("./ajax-loader.gif")
|
13
|
-
end
|
14
|
-
|
15
|
-
asserts("base informations accessor") do
|
16
|
-
result = true
|
17
|
-
result &= (topic.type == :GIF)
|
18
|
-
result &= (topic.version == :"89a")
|
19
|
-
result &= (topic.width == 32)
|
20
|
-
result &= (topic.height == 32)
|
21
|
-
result &= (topic.color_resolution == 64)
|
22
|
-
result &= (topic.pixel_aspect_ratio.nil?)
|
23
|
-
result &= (topic.images_count == 12)
|
24
|
-
result &= (topic.cyclic?)
|
25
|
-
result &= (topic.animated?)
|
26
|
-
result &= (not topic.interlaced?)
|
27
|
-
result &= (not topic.transparent?)
|
28
|
-
end
|
29
|
-
end
|
30
|
-
|
31
|
-
context "GifInfo (animated, global structure)" do
|
32
|
-
setup do
|
33
|
-
data = Struct::new(:count, :color_tables_data, :images_data)::new(0, "", "")
|
34
|
-
File::open("./ajax-loader.gif", "rb") do |io|
|
35
|
-
GifInfo::parse(io) do |block|
|
36
|
-
data.count += 1
|
37
|
-
|
38
|
-
if [GifInfo::Blocks::GlobalColorTable, GifInfo::Blocks::LocalColorTable].include? block.class
|
39
|
-
data.color_tables_data << block.body
|
40
|
-
elsif block.kind_of? GifInfo::Blocks::ImageData
|
41
|
-
data.images_data << block.body.data
|
42
|
-
end
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
data
|
47
|
-
end
|
48
|
-
|
49
|
-
asserts("blocks count") do
|
50
|
-
topic.count == 42
|
51
|
-
end
|
52
|
-
|
53
|
-
asserts("color tables content") do
|
54
|
-
Digest::MD5.hexdigest(topic.color_tables_data) == "48b630060f3cc156c8b35ba58eaade5c"
|
55
|
-
end
|
56
|
-
|
57
|
-
asserts("images data") do
|
58
|
-
Digest::MD5.hexdigest(topic.images_data) == "a660b40aa42d09e3f79107edfdd4b042"
|
59
|
-
end
|
60
|
-
end
|
61
|
-
|
62
|
-
context "GifInfo (unanimated, base informations)" do
|
63
|
-
setup do
|
64
|
-
GifInfo::analyze_file("./ajax-loader-0.gif")
|
65
|
-
end
|
66
|
-
|
67
|
-
asserts("base informations accessor") do
|
68
|
-
result = true
|
69
|
-
result &= (topic.type == :GIF)
|
70
|
-
result &= (topic.version == :"89a")
|
71
|
-
result &= (topic.width == 32)
|
72
|
-
result &= (topic.height == 32)
|
73
|
-
result &= (topic.color_resolution == 256)
|
74
|
-
result &= (topic.pixel_aspect_ratio.nil?)
|
75
|
-
result &= (topic.images_count == 1)
|
76
|
-
result &= (not topic.cyclic?)
|
77
|
-
result &= (not topic.animated?)
|
78
|
-
result &= (not topic.interlaced?)
|
79
|
-
result &= (not topic.transparent?)
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context "GifInfo (unanimated, global structure)" do
|
84
|
-
setup do
|
85
|
-
data = Struct::new(:count, :color_tables_data, :images_data)::new(0, "", "")
|
86
|
-
File::open("./ajax-loader-0.gif", "rb") do |io|
|
87
|
-
GifInfo::parse(io) do |block|
|
88
|
-
data.count += 1
|
89
|
-
|
90
|
-
if [GifInfo::Blocks::GlobalColorTable, GifInfo::Blocks::LocalColorTable].include? block.class
|
91
|
-
data.color_tables_data << block.body
|
92
|
-
elsif block.kind_of? GifInfo::Blocks::ImageData
|
93
|
-
data.images_data << block.body.data
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
|
98
|
-
data
|
99
|
-
end
|
100
|
-
|
101
|
-
asserts("blocks count") do
|
102
|
-
topic.count == 8
|
103
|
-
end
|
104
|
-
|
105
|
-
asserts("color tables content") do
|
106
|
-
Digest::MD5.hexdigest(topic.color_tables_data) == "fc55558e8169339f09831300b068fd41"
|
107
|
-
end
|
108
|
-
|
109
|
-
asserts("images data") do
|
110
|
-
Digest::MD5.hexdigest(topic.images_data) == "e26142b66066aaa01316f14982e45dea"
|
111
|
-
end
|
112
|
-
end
|