micro_magick 0.0.3 → 0.0.5
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/.travis.yml +10 -0
- data/README.md +32 -35
- data/lib/micro_magick/convert.rb +6 -4
- data/lib/micro_magick/version.rb +1 -1
- data/micro_magick.gemspec +1 -1
- data/test/geometry_test.rb +1 -0
- data/test/micro_gmagick_test.rb +1 -1
- data/test/micro_imagick_test.rb +1 -1
- data/test/micro_magick_test.rb +1 -0
- metadata +6 -5
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -1,26 +1,11 @@
|
|
1
|
-
#
|
1
|
+
# [ImageMagick](http://www.imagemagick.org/)/[GraphicsMagick](http://www.graphicsmagick.org/) Ruby wrapper
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Yes. Seriously.
|
6
|
-
|
7
|
-
### The other five libraries didn't make you happy?
|
8
|
-
|
9
|
-
No.
|
10
|
-
|
11
|
-
### OK, Sunshine, cry me a river.
|
12
|
-
|
13
|
-
All I wanted was something that
|
14
|
-
|
15
|
-
* didn't create temporary files unnecessarily (like mini_magick)
|
16
|
-
* didn't fail with valid geometry specifications, like ```640x480>``` (like mini_magick and quick_magick)
|
17
|
-
* didn't assume you only needed to resize your images (like imagery)
|
18
|
-
* didn't think you're going to run a public image caching service (like magickly)
|
3
|
+
[](http://travis-ci.org/mceachen/micro_magick)
|
19
4
|
|
20
5
|
## Usage
|
21
6
|
|
22
|
-
```micro_magick``` is an exec wrapper for the ```convert``` command
|
23
|
-
|
7
|
+
```micro_magick``` is an exec wrapper for the ```convert``` command in either GraphicsMagick or ImageMagic.
|
8
|
+
```convert``` reads an image from a given input file, performs operations on it, then saves the result to a different file.
|
24
9
|
|
25
10
|
```ruby
|
26
11
|
img = MicroMagick::Convert.new("/path/to/image.jpg")
|
@@ -38,6 +23,23 @@ This results in the following system call:
|
|
38
23
|
|
39
24
|
```gm convert -size 640x480 /path/to/image.jpg +profile \* -quality 85 -resize "640x480>" /new/path/image-640x480.jpg```
|
40
25
|
|
26
|
+
|
27
|
+
### Installation
|
28
|
+
|
29
|
+
You'll want to [install GraphicsMagick](http://www.graphicsmagick.org/README.html), then
|
30
|
+
|
31
|
+
```
|
32
|
+
gem install micro_magick
|
33
|
+
```
|
34
|
+
|
35
|
+
or add to your Gemfile:
|
36
|
+
|
37
|
+
```
|
38
|
+
gem 'micro_magick'
|
39
|
+
```
|
40
|
+
|
41
|
+
and run ```bundle```.
|
42
|
+
|
41
43
|
### "Plus" options
|
42
44
|
|
43
45
|
To add an output option that has a "plus" prefix, like, ```+matte```, use ```.add_output_option("+matte")```.
|
@@ -49,8 +51,6 @@ There are a couple additional methods that have been added to address common ima
|
|
49
51
|
* ```img.strip``` removes all comments and EXIF headers
|
50
52
|
* ```img.square_crop``` crops the image to a square (so a 640x480 image would crop down to a 480x480 image, cropped in the middle).
|
51
53
|
|
52
|
-
|
53
|
-
|
54
54
|
Note that all of ```convert```'s options are supported, but ```micro_magick``` does no validations.
|
55
55
|
A ```MicroMagick::ArgumentError``` will be raised on ```.write``` if
|
56
56
|
convert writes anything to stderr or the return value is not 0.
|
@@ -60,7 +60,7 @@ but you can force the library MicroMagick uses by calling ```MicroMagick.use(:gr
|
|
60
60
|
|
61
61
|
In-place image edits through ```mogrify``` are not supported (yet).
|
62
62
|
|
63
|
-
|
63
|
+
## GraphicsMagick versus ImageMagick
|
64
64
|
|
65
65
|
*At least in my testing, GraphicsMagick blows ImageMagick out of the water.*
|
66
66
|
|
@@ -71,21 +71,14 @@ In resizing a 2248x4000 image to 640x480:
|
|
71
71
|
|
72
72
|
Not only is GraphicsMagick 4 times faster, it produces 2.5x smaller output with the same quality--WIN WIN.
|
73
73
|
|
74
|
-
##
|
75
|
-
|
76
|
-
You'll want to [install GraphicsMagick](http://www.graphicsmagick.org/README.html), then
|
77
|
-
|
78
|
-
```
|
79
|
-
gem install micro_magick
|
80
|
-
```
|
74
|
+
## MicroMagick versus the competition
|
81
75
|
|
82
|
-
|
76
|
+
Why does the world need another *Magick wrapper? Because I needed a library that:
|
83
77
|
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
and run ```bundle```.
|
78
|
+
* didn't create temporary files unnecessarily (like mini_magick)
|
79
|
+
* didn't fail with valid geometry specifications, like ```640x480>``` (like mini_magick and quick_magick)
|
80
|
+
* didn't assume you only needed to resize your images (like imagery)
|
81
|
+
* didn't think you're going to run a public image caching service (like magickly)
|
89
82
|
|
90
83
|
## Change history
|
91
84
|
|
@@ -96,3 +89,7 @@ Let's get this party started.
|
|
96
89
|
### 0.0.3
|
97
90
|
|
98
91
|
Added square_crop, image dimensions, and support for ```+option```s.
|
92
|
+
|
93
|
+
### 0.0.4
|
94
|
+
|
95
|
+
Input file -size render hint is now only used with simple dimension specifications
|
data/lib/micro_magick/convert.rb
CHANGED
@@ -46,10 +46,12 @@ module MicroMagick
|
|
46
46
|
# * and we have dimensions in the form of NNNxNNN
|
47
47
|
if %w{-geometry -resize -sample -scale}.include?(option_name) &&
|
48
48
|
@input_options.empty? &&
|
49
|
-
!@output_options.include?("-crop")
|
50
|
-
(dimensions = args.first)
|
51
|
-
|
52
|
-
|
49
|
+
!@output_options.include?("-crop")
|
50
|
+
if (dimensions = args.first)
|
51
|
+
if dimensions =~ /^(\d+x\d+)$/
|
52
|
+
@input_options << "-size #{dimensions}"
|
53
|
+
end
|
54
|
+
end
|
53
55
|
end
|
54
56
|
end
|
55
57
|
|
data/lib/micro_magick/version.rb
CHANGED
data/micro_magick.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |s|
|
|
7
7
|
s.version = MicroMagick::VERSION
|
8
8
|
s.authors = ["Matthew McEachen"]
|
9
9
|
s.email = ["matthew-github@mceachen.org"]
|
10
|
-
s.homepage = ""
|
10
|
+
s.homepage = "https://github.com/mceachen/micro_magick"
|
11
11
|
s.summary = %q{Simplest ImageMagick/GraphicsMagick ruby wrapper EVAR}
|
12
12
|
s.description = %q{Simplest ImageMagick/GraphicsMagick ruby wrapper EVAR}
|
13
13
|
|
data/test/geometry_test.rb
CHANGED
data/test/micro_gmagick_test.rb
CHANGED
data/test/micro_imagick_test.rb
CHANGED
data/test/micro_magick_test.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: micro_magick
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matthew McEachen
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-05 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
prerelease: false
|
@@ -42,6 +42,7 @@ extra_rdoc_files: []
|
|
42
42
|
|
43
43
|
files:
|
44
44
|
- .gitignore
|
45
|
+
- .travis.yml
|
45
46
|
- Gemfile
|
46
47
|
- README.md
|
47
48
|
- Rakefile
|
@@ -56,7 +57,7 @@ files:
|
|
56
57
|
- test/micro_imagick_test.rb
|
57
58
|
- test/micro_magick_test.rb
|
58
59
|
- test/micro_magick_test_base.rb
|
59
|
-
homepage:
|
60
|
+
homepage: https://github.com/mceachen/micro_magick
|
60
61
|
licenses: []
|
61
62
|
|
62
63
|
post_install_message:
|