ImageResize 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +3 -0
- data/README.rdoc +5 -0
- data/java/ImageResize.class +0 -0
- data/java/ImageResize.jar +0 -0
- data/lib/ImageResize.rb +1 -1
- data/lib/ImageResize/Image.rb +34 -2
- metadata +3 -3
data/History.txt
CHANGED
data/README.rdoc
CHANGED
@@ -14,6 +14,11 @@ Simple image resize library without external program.
|
|
14
14
|
# input_image_filename, output_image_filename, max_width, max_height
|
15
15
|
Image.resize('big.jpg', 'small.jpg', 40, 40)
|
16
16
|
|
17
|
+
# show formats
|
18
|
+
p Image.formats
|
19
|
+
p Image.read_formats
|
20
|
+
p Image.write_formats
|
21
|
+
|
17
22
|
== REQUIREMENTS:
|
18
23
|
|
19
24
|
* Java 1.5 or higher
|
data/java/ImageResize.class
CHANGED
Binary file
|
data/java/ImageResize.jar
CHANGED
Binary file
|
data/lib/ImageResize.rb
CHANGED
data/lib/ImageResize/Image.rb
CHANGED
@@ -1,11 +1,43 @@
|
|
1
1
|
module Image
|
2
|
+
|
3
|
+
$VERBOSE = nil
|
2
4
|
|
3
|
-
def Image.
|
5
|
+
def Image.cmd
|
4
6
|
jar_path = File.expand_path(File.dirname(__FILE__)).split(/\//)
|
5
7
|
jar_path.pop
|
6
8
|
jar_path.pop
|
7
9
|
resizer = "#{jar_path.join('/')}/java/ImageResize.jar"
|
8
|
-
|
10
|
+
"java -jar #{resizer}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def Image.resize(img_in, img_out, width, height)
|
14
|
+
puts `#{Image.cmd} resize #{img_in} #{img_out} #{width} #{height}`
|
15
|
+
end
|
16
|
+
|
17
|
+
def Image.formats
|
18
|
+
lines = `#{Image.cmd} formats`
|
19
|
+
read_formats = nil
|
20
|
+
write_formats = nil
|
21
|
+
for line in lines.split(/[\r\n]/) do
|
22
|
+
rw, format = line.split(/\:/)
|
23
|
+
formats = format.split(/,/).map{|f|f.downcase}.uniq.sort
|
24
|
+
if rw == 'read'
|
25
|
+
read_formats = formats
|
26
|
+
elsif rw == 'write'
|
27
|
+
write_formats = formats
|
28
|
+
end
|
29
|
+
end
|
30
|
+
return read_formats, write_formats
|
31
|
+
end
|
32
|
+
|
33
|
+
def Image.read_formats
|
34
|
+
r,w = Image.formats
|
35
|
+
r
|
36
|
+
end
|
37
|
+
|
38
|
+
def Image.write_formats
|
39
|
+
r,w = Image.formats
|
40
|
+
w
|
9
41
|
end
|
10
42
|
|
11
43
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ImageResize
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 23
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 4
|
10
|
+
version: 0.0.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Sho Hashimoto
|