identify 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/CHANGELOG +4 -0
  2. data/README.md +15 -12
  3. data/lib/identify.rb +3 -3
  4. metadata +2 -2
data/CHANGELOG CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.1.1 (2012-06-10)
2
+
3
+ * optimizations to png & gif header detection.
4
+
1
5
  == 0.1.0 (2012-06-07)
2
6
 
3
7
  * Initial version.
data/README.md CHANGED
@@ -2,33 +2,36 @@
2
2
 
3
3
  A pure ruby image identification library.
4
4
 
5
+ ## Install
6
+
7
+ `gem install identify`
8
+
5
9
  ## Supported Formats
6
10
 
7
- * BMP
8
- * PNG
9
- * JPG
10
- * GIF
11
- * XPM
12
- * PPM
13
- * PGM
14
- * PNM
15
- * PBM
16
- * XBM
17
- * TIFF
11
+ BMP, PNG, JPG, GIF, XPM, PPM, PGM, PNM, PBM, XBM, TIFF
18
12
 
19
13
  ## Example
20
14
 
21
15
  ```ruby
22
16
  require 'identify'
23
17
 
24
- Identify.image File.binread("test/images/test.png", 1024) #=> {:format => "png", :width => 253, :height => 178}
18
+ p Identify.image File.binread("test/images/test.png", 1024)
19
+ ```
20
+
21
+ ### Output
25
22
 
23
+ ```
24
+ {:width=>253, :height=>178, :format=>"png"}
26
25
  ```
27
26
 
28
27
  ## Testing
29
28
 
30
29
  Tests require a local installation of ImageMagick and `identify` to be in your `$PATH`
31
30
 
31
+ ## TODO
32
+
33
+ Channel type, Depth, Colorspace and Resolution.
34
+
32
35
  # See Also
33
36
  [http://rubygems.org/gems/imagesize](http://rubygems.org/gems/imagesize)
34
37
 
@@ -1,5 +1,5 @@
1
1
  module Identify
2
- VERSION = '0.1.0'
2
+ VERSION = '0.1.1'
3
3
 
4
4
  def self.image data
5
5
  Image.identify(data)
@@ -125,7 +125,7 @@ module Identify
125
125
 
126
126
  class GIF < Image
127
127
  def self.handle? data
128
- data.index("GIF89a") == 0 || data.index("GIF87a")
128
+ data.start_with?("GIF89a", "GIF87a")
129
129
  end
130
130
 
131
131
  def parse data
@@ -140,7 +140,7 @@ module Identify
140
140
 
141
141
  def parse data
142
142
  {}.tap do |meta|
143
- meta.merge! as_hash('png', *data.unpack("x16NN")) if data.index("IHDR") == 12
143
+ meta.merge! as_hash('png', *data.unpack("x16NN")) if data[12..15] == "IHDR"
144
144
  end
145
145
  end
146
146
  end # PNG
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: identify
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-07 00:00:00.000000000 Z
12
+ date: 2012-06-10 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rake