quick_magick 0.2.0 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of quick_magick might be problematic. Click here for more details.
- data/README +42 -3
- data/Rakefile +1 -1
- data/lib/quick_magick/image.rb +4 -3
- data/quick_magick.gemspec +1 -1
- metadata +1 -1
data/README
CHANGED
@@ -11,15 +11,54 @@ This is sometimes preferable but not in all cases.
|
|
11
11
|
It uses a huge amonut of memory when manipulating images of large sizes.
|
12
12
|
QuickMagick allows you to access all the powerful commands of ImageMagick that are accessible from command line.
|
13
13
|
When you need more advanced options like reading pixel values, you should go to RMagick.
|
14
|
+
Another good point in QuickMagick is that it's very easy to install.
|
15
|
+
It doesn't require any Magick libraries or compile something from source to be installed.
|
16
|
+
A running copy of ImageMagick is enough.
|
14
17
|
|
15
|
-
The idea of this gem came from
|
16
|
-
I used
|
18
|
+
The idea of this gem came from MiniMagick.
|
19
|
+
I used MiniMagick for a little time but I found that some advanced options are missing.
|
17
20
|
For example, you cannot manipulate multipage images.
|
18
21
|
Also, it uses "mogrify" and creates temporary files to simulate the "convert" command which makes it slower as it accesses the disk multiple times.
|
19
|
-
Another small
|
22
|
+
Another small stuff is that it relies on method_missing to set command line arguments which is slow and not preferable.
|
20
23
|
|
21
24
|
In QuickMagick I tried to solve the above problems while keeping the API as easy as possible.
|
22
25
|
|
26
|
+
== Comparison
|
27
|
+
|
28
|
+
I've made some test benches to compare the speed of QuickMagick, MiniMagick and RMagick.
|
29
|
+
Here are the results:
|
30
|
+
|
31
|
+
Test 1: resize a normal image (20 times)
|
32
|
+
user system total real
|
33
|
+
mini 0.010000 0.070000 3.730000 ( 3.693978)
|
34
|
+
quick 0.010000 0.040000 3.270000 ( 3.124558)
|
35
|
+
rmagick 1.740000 1.610000 3.350000 ( 3.283624)
|
36
|
+
|
37
|
+
It's clear that QuickMagick is faster that MiniMagick.
|
38
|
+
In this run RMagick was a little bit slower than QuickMagick.
|
39
|
+
Actually, this is not always the case.
|
40
|
+
Sometimes It's faster than QuickMagick.
|
41
|
+
On average, we can say that they both take the same time.
|
42
|
+
|
43
|
+
Test 2: resize a large image
|
44
|
+
user system total real
|
45
|
+
mini 0.000000 0.030000 58.090000 ( 33.852697)
|
46
|
+
quick 0.000000 0.000000 55.820000 ( 31.492870)
|
47
|
+
|
48
|
+
Again QuickMagick is faster than MiniMagick.
|
49
|
+
However, RMagick has failed to pass this test.
|
50
|
+
It kept working and eating memory, cpu and harddisk till I had to unplug my computer to stop it.
|
51
|
+
So, I removed it from this test bench.
|
52
|
+
|
53
|
+
Test 3: generate random captchas (20)
|
54
|
+
user system total real
|
55
|
+
quick 0.010000 0.020000 3.610000 ( 4.952026)
|
56
|
+
rmagick 1.320000 1.640000 2.960000 ( 3.058445)
|
57
|
+
|
58
|
+
In this last test, RMagick was 38% faster than QuickMagick.
|
59
|
+
This is normal because it works in memory and doesn't have to parse a command line string to know what to draw.
|
60
|
+
I couldn't test MiniMagick for this because it doesn't support an API for drawing functions.
|
61
|
+
|
23
62
|
== Examples
|
24
63
|
|
25
64
|
Determine image information
|
data/Rakefile
CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
|
|
2
2
|
require 'rake'
|
3
3
|
require 'echoe'
|
4
4
|
|
5
|
-
Echoe.new('quick_magick', '0.
|
5
|
+
Echoe.new('quick_magick', '0.3.0') do |p|
|
6
6
|
p.description = "QuickMagick allows you to access ImageMagick command line functions using Ruby interface."
|
7
7
|
p.url = "http://quickmagick.rubyforge.org/"
|
8
8
|
p.author = "Ahmed ElDawy"
|
data/lib/quick_magick/image.rb
CHANGED
@@ -82,12 +82,12 @@ module QuickMagick
|
|
82
82
|
|
83
83
|
# append the given option, value pair to the args for the current image
|
84
84
|
def append_to_operators(arg, value="")
|
85
|
-
@operators << %Q<-#{arg} "#{value}">
|
85
|
+
@operators << %Q<-#{arg} "#{value}" >
|
86
86
|
end
|
87
87
|
|
88
88
|
# append the given option, value pair to the settings of the current image
|
89
89
|
def append_to_settings(arg, value="")
|
90
|
-
@settings << %Q<-#{arg} "#{value}">
|
90
|
+
@settings << %Q<-#{arg} "#{value}" >
|
91
91
|
end
|
92
92
|
|
93
93
|
# Image settings supported by ImageMagick
|
@@ -131,7 +131,8 @@ module QuickMagick
|
|
131
131
|
WITH_EQUAL_METHODS =
|
132
132
|
%w{alpha antialias background bias black-point-compensation blue-primary border bordercolor caption
|
133
133
|
cahnnel colors colorspace comment compose compress depth density encoding endian family fill filter
|
134
|
-
font format frame fuzz geometry gravity label mattecolor page pointsize quality
|
134
|
+
font format frame fuzz geometry gravity label mattecolor page pointsize quality stroke strokewidth
|
135
|
+
undercolor units weight
|
135
136
|
brodercolor transparent type size}
|
136
137
|
|
137
138
|
# methods that takes geometry options
|
data/quick_magick.gemspec
CHANGED