jemmyw-image_science 1.3.2.1.Jemmyw → 1.3.3.0.Jemmyw
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +1 -0
- data/History.txt +12 -0
- data/Rakefile +11 -3
- data/ext/image_science/image_science.c +12 -3
- data/image_science.gemspec +1 -1
- data/lib/image_science/version.rb +1 -1
- data/test/test_image_science.rb +16 -1
- metadata +47 -30
data/Gemfile
CHANGED
data/History.txt
CHANGED
@@ -1,3 +1,15 @@
|
|
1
|
+
=== 1.3.3.0.Jemmyw
|
2
|
+
|
3
|
+
* 1 enhancement:
|
4
|
+
|
5
|
+
* bytes method takes type string for image conversion.
|
6
|
+
|
7
|
+
=== 1.3.2.1.Jemmyw
|
8
|
+
|
9
|
+
* 1 enhancement:
|
10
|
+
|
11
|
+
* Added bytes method to get the image data as a ruby string.
|
12
|
+
|
1
13
|
=== 1.2.1 / 2009-08-14
|
2
14
|
|
3
15
|
* 2 minor enhancements:
|
data/Rakefile
CHANGED
@@ -6,11 +6,19 @@ task :build => [:compile, :chmod]
|
|
6
6
|
task :compile do
|
7
7
|
`ruby ext/image_science/extconf.rb`
|
8
8
|
`make`
|
9
|
-
|
10
|
-
|
9
|
+
|
10
|
+
if File.exists?("extension.so")
|
11
|
+
`mv extension.so lib/image_science/extension.so`
|
12
|
+
elsif File.exists?("extension.bundle")
|
13
|
+
`mv extension.bundle lib/image_science/extension.bundle`
|
14
|
+
else
|
15
|
+
raise "No extension file build"
|
16
|
+
end
|
11
17
|
end
|
12
18
|
|
13
19
|
task :chmod do
|
14
|
-
|
20
|
+
Dir["lib/image_science/extension.{so,bundle}"].each do |file|
|
21
|
+
File.chmod(0775, file)
|
22
|
+
end
|
15
23
|
end
|
16
24
|
|
@@ -195,13 +195,22 @@ static VALUE save(VALUE self, VALUE _output) {
|
|
195
195
|
rb_raise(rb_eTypeError, "Unknown file format");
|
196
196
|
}
|
197
197
|
|
198
|
-
static VALUE bytes(VALUE self) {
|
198
|
+
static VALUE bytes(int argc, VALUE *argv, VALUE self) {
|
199
199
|
FIMEMORY *hmem = NULL;
|
200
200
|
FIBITMAP *bitmap;
|
201
201
|
VALUE byte_string;
|
202
|
+
VALUE type_string;
|
202
203
|
int flags;
|
204
|
+
FREE_IMAGE_FORMAT fif;
|
203
205
|
|
204
|
-
|
206
|
+
rb_scan_args(argc, argv, "01", &type_string);
|
207
|
+
|
208
|
+
if (NIL_P(type_string)) {
|
209
|
+
fif = FIX2INT(rb_iv_get(self, "@file_type"));
|
210
|
+
} else {
|
211
|
+
char * type = StringValuePtr(type_string);
|
212
|
+
fif = FreeImage_GetFIFFromFilename(type);
|
213
|
+
}
|
205
214
|
|
206
215
|
if ((fif != FIF_UNKNOWN) && FreeImage_FIFSupportsWriting(fif)) {
|
207
216
|
GET_BITMAP(bitmap);
|
@@ -243,7 +252,7 @@ extern "C" {
|
|
243
252
|
rb_define_method(c, "height", (VALUE(*)(ANYARGS))height, 0);
|
244
253
|
rb_define_method(c, "resize", (VALUE(*)(ANYARGS))resize, 2);
|
245
254
|
rb_define_method(c, "save", (VALUE(*)(ANYARGS))save, 1);
|
246
|
-
rb_define_method(c, "bytes", (VALUE(*)(ANYARGS))bytes,
|
255
|
+
rb_define_method(c, "bytes", (VALUE(*)(ANYARGS))bytes, -1);
|
247
256
|
rb_define_method(c, "width", (VALUE(*)(ANYARGS))width, 0);
|
248
257
|
rb_define_method(c, "with_crop", (VALUE(*)(ANYARGS))with_crop, 4);
|
249
258
|
rb_define_singleton_method(c, "with_image", (VALUE(*)(ANYARGS))with_image, 1);
|
data/image_science.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.platform = Gem::Platform::RUBY
|
8
8
|
s.authors = ['Ryan Davis', 'Craig Buchek']
|
9
9
|
s.email = ['craig.buchek@asolutions.com']
|
10
|
-
s.homepage = "http://github.com/jemmyw
|
10
|
+
s.homepage = "http://github.com/jemmyw/image_science"
|
11
11
|
s.summary = %q{Replacement for RMagick; uses FreeImage instead of ImageMagick}
|
12
12
|
s.description = %q{ImageScience is a clean and happy Ruby library that generates
|
13
13
|
thumbnails -- and kicks the living crap out of RMagick. Oh, and it
|
data/test/test_image_science.rb
CHANGED
@@ -48,7 +48,7 @@ class TestImageScience < MiniTest::Unit::TestCase
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def test_class_with_image_missing_with_img_extension
|
51
|
-
assert_raises
|
51
|
+
assert_raises TypeError do
|
52
52
|
assert_nil ImageScience.with_image("nope#{@path}") do |img|
|
53
53
|
flunk
|
54
54
|
end
|
@@ -96,6 +96,21 @@ class TestImageScience < MiniTest::Unit::TestCase
|
|
96
96
|
end
|
97
97
|
end
|
98
98
|
|
99
|
+
def test_bytes_with_type
|
100
|
+
data = File.new(@path).binmode.read
|
101
|
+
@tmppath = "test/pix-tmp.jpg"
|
102
|
+
|
103
|
+
ImageScience.with_image_from_memory data do |img|
|
104
|
+
File.open(@tmppath, "wb"){|f| f.write img.bytes("jpeg")}
|
105
|
+
assert_equal 1256, File.size(@tmppath)
|
106
|
+
|
107
|
+
ImageScience.with_image(@tmppath) do |img2|
|
108
|
+
assert_equal(img2.width, img.width)
|
109
|
+
assert_equal(img2.height, img.height)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
99
114
|
def test_resize
|
100
115
|
ImageScience.with_image @path do |img|
|
101
116
|
img.resize(25, 25) do |thumb|
|
metadata
CHANGED
@@ -1,38 +1,44 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: jemmyw-image_science
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
hash: 1832185373
|
5
5
|
prerelease: 8
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 3
|
9
|
+
- 3
|
10
|
+
- 0
|
11
|
+
- Jemmyw
|
12
|
+
version: 1.3.3.0.Jemmyw
|
6
13
|
platform: ruby
|
7
|
-
authors:
|
14
|
+
authors:
|
8
15
|
- Ryan Davis
|
9
16
|
- Craig Buchek
|
10
17
|
autorequire:
|
11
18
|
bindir: bin
|
12
19
|
cert_chain: []
|
13
|
-
|
20
|
+
|
21
|
+
date: 2012-08-23 00:00:00 Z
|
14
22
|
dependencies: []
|
15
|
-
description: ! 'ImageScience is a clean and happy Ruby library that generates
|
16
23
|
|
24
|
+
description: |
|
25
|
+
ImageScience is a clean and happy Ruby library that generates
|
17
26
|
thumbnails -- and kicks the living crap out of RMagick. Oh, and it
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
27
|
+
doesn't leak memory like a sieve. :)
|
28
|
+
|
22
29
|
This fork does not require RubyInline.
|
23
|
-
|
24
|
-
|
30
|
+
|
25
31
|
For more information (on the original variant), see http://seattlerb.rubyforge.org/ImageScience.html
|
26
32
|
|
27
|
-
|
28
|
-
email:
|
33
|
+
email:
|
29
34
|
- craig.buchek@asolutions.com
|
30
|
-
executables:
|
35
|
+
executables:
|
31
36
|
- image_science_thumb
|
32
|
-
extensions:
|
37
|
+
extensions:
|
33
38
|
- ext/image_science/extconf.rb
|
34
39
|
extra_rdoc_files: []
|
35
|
-
|
40
|
+
|
41
|
+
files:
|
36
42
|
- .gitignore
|
37
43
|
- Gemfile
|
38
44
|
- History.txt
|
@@ -49,30 +55,41 @@ files:
|
|
49
55
|
- lib/image_science/version.rb
|
50
56
|
- test/pix.png
|
51
57
|
- test/test_image_science.rb
|
52
|
-
homepage: http://github.com/jemmyw/
|
58
|
+
homepage: http://github.com/jemmyw/image_science
|
53
59
|
licenses: []
|
60
|
+
|
54
61
|
post_install_message:
|
55
62
|
rdoc_options: []
|
56
|
-
|
63
|
+
|
64
|
+
require_paths:
|
57
65
|
- lib
|
58
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
66
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
59
67
|
none: false
|
60
|
-
requirements:
|
61
|
-
- -
|
62
|
-
- !ruby/object:Gem::Version
|
63
|
-
|
64
|
-
|
68
|
+
requirements:
|
69
|
+
- - ">="
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
hash: 3
|
72
|
+
segments:
|
73
|
+
- 0
|
74
|
+
version: "0"
|
75
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
65
76
|
none: false
|
66
|
-
requirements:
|
67
|
-
- -
|
68
|
-
- !ruby/object:Gem::Version
|
77
|
+
requirements:
|
78
|
+
- - ">"
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
hash: 25
|
81
|
+
segments:
|
82
|
+
- 1
|
83
|
+
- 3
|
84
|
+
- 1
|
69
85
|
version: 1.3.1
|
70
86
|
requirements: []
|
87
|
+
|
71
88
|
rubyforge_project: image_science
|
72
|
-
rubygems_version: 1.8.
|
89
|
+
rubygems_version: 1.8.23
|
73
90
|
signing_key:
|
74
91
|
specification_version: 3
|
75
92
|
summary: Replacement for RMagick; uses FreeImage instead of ImageMagick
|
76
|
-
test_files:
|
93
|
+
test_files:
|
77
94
|
- test/pix.png
|
78
95
|
- test/test_image_science.rb
|