sobakasu-image_science 1.1.3 → 1.1.4
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.
- data/History.txt +8 -2
- data/bin/image_science +16 -3
- data/ext/image_science_ext.c.in +5 -1
- data/lib/image_science.rb +1 -1
- metadata +44 -11
data/History.txt
CHANGED
@@ -1,6 +1,12 @@
|
|
1
|
-
== 1.1.
|
1
|
+
== 1.1.4 / 2010-09-15
|
2
2
|
|
3
|
-
*
|
3
|
+
* added 'fit_within' command to bin/image_science.
|
4
|
+
* added options information to bin/image_science -h
|
5
|
+
* merged changes from scotje/image_science - fix for gif conversion to 8bit
|
6
|
+
|
7
|
+
== 1.1.3 / 2010-02-23
|
8
|
+
|
9
|
+
* fixed parameters to FreeImage_Rotate
|
4
10
|
|
5
11
|
== 1.1.2 / 2010-02-12
|
6
12
|
|
data/bin/image_science
CHANGED
@@ -29,12 +29,13 @@
|
|
29
29
|
#
|
30
30
|
# == Commands
|
31
31
|
#
|
32
|
-
# The following commands are recognised
|
32
|
+
# The following commands are recognised:
|
33
33
|
#
|
34
34
|
# * info
|
35
35
|
# * histogram
|
36
36
|
# * get_version
|
37
37
|
# * resize <width> <height>
|
38
|
+
# * fit_within <max_width> <max_height>
|
38
39
|
# * crop <left> <top> <right> <bottom>
|
39
40
|
# * get_pixel_color <x> <y>
|
40
41
|
# * set_pixel_color <x> <y> <red> <green> <blue> [<alpha>]
|
@@ -125,9 +126,18 @@ def usage(bonus_args = nil)
|
|
125
126
|
cmd = @command || "[command]"
|
126
127
|
usage = ["usage: image_science [OPTIONS]", cmd, bonus_args, "[image_file]"].
|
127
128
|
compact.join(" ")
|
128
|
-
|
129
|
+
|
130
|
+
usage += "\n\n"
|
131
|
+
usage += <<EOM
|
132
|
+
options:
|
133
|
+
-h: display this help message
|
134
|
+
-i: input file (by default read from stdin, or last argument)
|
135
|
+
-o: output file (by default write to stdout, or a file named 'output')
|
136
|
+
-d: debug mode
|
137
|
+
EOM
|
138
|
+
|
129
139
|
if !@command
|
130
|
-
re = Regexp.new('== Commands(.*?)= Examples', Regexp::MULTILINE)
|
140
|
+
re = Regexp.new('== Commands\n(.*?)= Examples', Regexp::MULTILINE)
|
131
141
|
commands = $1.gsub(/#/, '') if File.read(__FILE__).match(re)
|
132
142
|
usage += commands.sub(/[\n\s]+\z/, '') + "\n\n"
|
133
143
|
end
|
@@ -180,6 +190,9 @@ EOM
|
|
180
190
|
when 'resize'
|
181
191
|
w, h = expect_params(%W{<width> <height>})
|
182
192
|
process_data(opts) { |i| i.send(@command, w, h); @changed = true }
|
193
|
+
when 'fit_within'
|
194
|
+
w, h = expect_params(%W{<max_width> <max_height>})
|
195
|
+
process_data(opts) { |i| i.send(@command, w, h); @changed = true }
|
183
196
|
when 'get_pixel_color'
|
184
197
|
x, y = expect_params(%W{<x> <y>})
|
185
198
|
process_data(opts) { |i| warn i.get_pixel_color(x, y).inspect }
|
data/ext/image_science_ext.c.in
CHANGED
@@ -84,7 +84,11 @@ _prepare_bitmap_for_save(FIBITMAP *bitmap, FREE_IMAGE_FORMAT fif)
|
|
84
84
|
new_bitmap = FreeImage_ConvertTo24Bits(bitmap);
|
85
85
|
}
|
86
86
|
if (fif == FIF_GIF && FreeImage_GetBPP(bitmap) != 8) {
|
87
|
-
|
87
|
+
if (FreeImage_GetBPP(bitmap) != 24) {
|
88
|
+
new_bitmap = FreeImage_ColorQuantize(FreeImage_ConvertTo24Bits(bitmap), FIQ_WUQUANT);
|
89
|
+
} else {
|
90
|
+
new_bitmap = FreeImage_ColorQuantize(bitmap, FIQ_WUQUANT);
|
91
|
+
}
|
88
92
|
}
|
89
93
|
|
90
94
|
if (new_bitmap) copy_icc_profile(bitmap, new_bitmap, fif);
|
data/lib/image_science.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sobakasu-image_science
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 27
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 1
|
9
|
+
- 4
|
10
|
+
version: 1.1.4
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Ryan Davis
|
@@ -10,19 +16,41 @@ autorequire:
|
|
10
16
|
bindir: bin
|
11
17
|
cert_chain: []
|
12
18
|
|
13
|
-
date: 2010-
|
19
|
+
date: 2010-09-15 00:00:00 +09:30
|
14
20
|
default_executable:
|
15
21
|
dependencies:
|
16
22
|
- !ruby/object:Gem::Dependency
|
17
|
-
name:
|
23
|
+
name: rubyforge
|
24
|
+
prerelease: false
|
25
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
26
|
+
none: false
|
27
|
+
requirements:
|
28
|
+
- - ">="
|
29
|
+
- !ruby/object:Gem::Version
|
30
|
+
hash: 7
|
31
|
+
segments:
|
32
|
+
- 2
|
33
|
+
- 0
|
34
|
+
- 4
|
35
|
+
version: 2.0.4
|
18
36
|
type: :development
|
19
|
-
|
20
|
-
|
37
|
+
version_requirements: *id001
|
38
|
+
- !ruby/object:Gem::Dependency
|
39
|
+
name: hoe
|
40
|
+
prerelease: false
|
41
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
21
43
|
requirements:
|
22
44
|
- - ">="
|
23
45
|
- !ruby/object:Gem::Version
|
24
|
-
|
25
|
-
|
46
|
+
hash: 19
|
47
|
+
segments:
|
48
|
+
- 2
|
49
|
+
- 6
|
50
|
+
- 2
|
51
|
+
version: 2.6.2
|
52
|
+
type: :development
|
53
|
+
version_requirements: *id002
|
26
54
|
description: |-
|
27
55
|
ImageScience is a clean and happy Ruby library that generates
|
28
56
|
thumbnails -- and kicks the living crap out of RMagick. Oh, and it
|
@@ -73,23 +101,28 @@ rdoc_options:
|
|
73
101
|
- README.txt
|
74
102
|
require_paths:
|
75
103
|
- lib
|
76
|
-
- ext
|
77
104
|
required_ruby_version: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
78
106
|
requirements:
|
79
107
|
- - ">="
|
80
108
|
- !ruby/object:Gem::Version
|
109
|
+
hash: 3
|
110
|
+
segments:
|
111
|
+
- 0
|
81
112
|
version: "0"
|
82
|
-
version:
|
83
113
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
84
115
|
requirements:
|
85
116
|
- - ">="
|
86
117
|
- !ruby/object:Gem::Version
|
118
|
+
hash: 3
|
119
|
+
segments:
|
120
|
+
- 0
|
87
121
|
version: "0"
|
88
|
-
version:
|
89
122
|
requirements: []
|
90
123
|
|
91
124
|
rubyforge_project: sobakasu-image_science
|
92
|
-
rubygems_version: 1.3.
|
125
|
+
rubygems_version: 1.3.7
|
93
126
|
signing_key:
|
94
127
|
specification_version: 3
|
95
128
|
summary: ImageScience is a clean and happy Ruby library that generates thumbnails -- and kicks the living crap out of RMagick
|