mini_magick 1.2.3 → 2.0.0

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.
metadata CHANGED
@@ -1,71 +1,107 @@
1
1
  --- !ruby/object:Gem::Specification
2
- rubygems_version: 0.9.0.1
3
- specification_version: 1
4
2
  name: mini_magick
5
3
  version: !ruby/object:Gem::Version
6
- version: 1.2.3
7
- date: 2007-06-15 00:00:00 -04:00
8
- summary: A simple image manipulation library based on ImageMagick.
9
- require_paths:
10
- - lib
11
- email: probablycorey+ruby@gmail.com
12
- homepage: http://www.zenspider.com/ZSS/Products/mini_magick/
13
- rubyforge_project: mini_magick
14
- description: "- Why? I was using RMagick and loving it, but it was eating up huge amounts of memory. A simple script like this... Magick::read(\"image.jpg\") do |f| f.write(\"manipulated.jpg\") end ...would use over 100 Megs of Ram. On my local machine this wasn't a problem, but on my hosting server the ruby apps would crash because of their 100 Meg memory limit."
15
- autorequire:
16
- default_executable:
17
- bindir: bin
18
- has_rdoc: true
19
- required_ruby_version: !ruby/object:Gem::Version::Requirement
20
- requirements:
21
- - - ">"
22
- - !ruby/object:Gem::Version
23
- version: 0.0.0
24
- version:
4
+ prerelease: false
5
+ segments:
6
+ - 2
7
+ - 0
8
+ - 0
9
+ version: 2.0.0
25
10
  platform: ruby
26
- signing_key:
27
- cert_chain:
28
- post_install_message:
29
11
  authors:
30
12
  - Corey Johnson
13
+ - Hampton Catlin
14
+ - Peter Kieltyka
15
+ autorequire:
16
+ bindir: bin
17
+ cert_chain: []
18
+
19
+ date: 2010-08-17 00:00:00 +01:00
20
+ default_executable:
21
+ dependencies:
22
+ - !ruby/object:Gem::Dependency
23
+ name: subexec
24
+ prerelease: false
25
+ requirement: &id001 !ruby/object:Gem::Requirement
26
+ none: false
27
+ requirements:
28
+ - - ~>
29
+ - !ruby/object:Gem::Version
30
+ segments:
31
+ - 0
32
+ - 0
33
+ - 4
34
+ version: 0.0.4
35
+ type: :runtime
36
+ version_requirements: *id001
37
+ description: ""
38
+ email:
39
+ - probablycorey@gmail.com
40
+ - hcatlin@gmail.com
41
+ - peter@nulayer.com
42
+ executables: []
43
+
44
+ extensions: []
45
+
46
+ extra_rdoc_files: []
47
+
31
48
  files:
49
+ - README.rdoc
50
+ - VERSION
32
51
  - MIT-LICENSE
33
- - History.txt
34
- - Manifest.txt
35
- - README.txt
36
52
  - Rakefile
37
- - init.rb
38
- - lib/image_temp_file.rb
53
+ - lib/mini_gmagick.rb
39
54
  - lib/mini_magick.rb
40
55
  - test/actually_a_gif.jpg
56
+ - test/animation.gif
57
+ - test/command_builder_test.rb
58
+ - test/composited.jpg
59
+ - test/image_test.rb
60
+ - test/leaves.tiff
41
61
  - test/not_an_image.php
62
+ - test/simple-minus.gif
42
63
  - test/simple.gif
43
- - test/test_image_temp_file.rb
44
- - test/test_mini_magick_test.rb
45
64
  - test/trogdor.jpg
46
- test_files:
47
- - test/test_image_temp_file.rb
48
- - test/test_mini_magick_test.rb
49
- rdoc_options:
50
- - --main
51
- - README.txt
52
- extra_rdoc_files:
53
- - History.txt
54
- - Manifest.txt
55
- - README.txt
56
- executables: []
65
+ has_rdoc: true
66
+ homepage: http://github.com/probablycorey/mini_magick
67
+ licenses: []
57
68
 
58
- extensions: []
69
+ post_install_message:
70
+ rdoc_options: []
59
71
 
72
+ require_paths:
73
+ - lib
74
+ required_ruby_version: !ruby/object:Gem::Requirement
75
+ none: false
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ segments:
80
+ - 0
81
+ version: "0"
82
+ required_rubygems_version: !ruby/object:Gem::Requirement
83
+ none: false
84
+ requirements:
85
+ - - ">="
86
+ - !ruby/object:Gem::Version
87
+ segments:
88
+ - 0
89
+ version: "0"
60
90
  requirements: []
61
91
 
62
- dependencies:
63
- - !ruby/object:Gem::Dependency
64
- name: hoe
65
- version_requirement:
66
- version_requirements: !ruby/object:Gem::Version::Requirement
67
- requirements:
68
- - - ">="
69
- - !ruby/object:Gem::Version
70
- version: 1.2.1
71
- version:
92
+ rubyforge_project:
93
+ rubygems_version: 1.3.7
94
+ signing_key:
95
+ specification_version: 3
96
+ summary: Manipulate images with minimal use of memory via ImageMagick / GraphicsMagick
97
+ test_files:
98
+ - test/actually_a_gif.jpg
99
+ - test/animation.gif
100
+ - test/command_builder_test.rb
101
+ - test/composited.jpg
102
+ - test/image_test.rb
103
+ - test/leaves.tiff
104
+ - test/not_an_image.php
105
+ - test/simple-minus.gif
106
+ - test/simple.gif
107
+ - test/trogdor.jpg
data/History.txt DELETED
@@ -1,11 +0,0 @@
1
- == 1.2.2 / 2007-06-01
2
-
3
- # 1.) all image commands return the image object (The output of the last command is saved in @output)
4
- # 2.) identify doesn't trip over strangley named files
5
- # 3.) TempFile uses file extention now (Thanks http://marsorange.com/archives/of-mogrify-ruby-tempfile-dynamic-class-definitions)
6
- # 4.) identify commands escape output path correctly
7
-
8
- == 1.2.3 / 2007-06-15
9
-
10
- # 1.) Image::from_file doesn't drop the file extension anymore, it and use the image_temp_file correctly
11
- # 4.) TempFiles are stored as an instance variable in Image instances so they don't get cleaned up prematurely via garbage collection
data/Manifest.txt DELETED
@@ -1,14 +0,0 @@
1
- MIT-LICENSE
2
- History.txt
3
- Manifest.txt
4
- README.txt
5
- Rakefile
6
- init.rb
7
- lib/image_temp_file.rb
8
- lib/mini_magick.rb
9
- test/actually_a_gif.jpg
10
- test/not_an_image.php
11
- test/simple.gif
12
- test/test_image_temp_file.rb
13
- test/test_mini_magick_test.rb
14
- test/trogdor.jpg
data/README.txt DELETED
@@ -1,101 +0,0 @@
1
- mini_magick
2
- by Coery Johnson
3
- FIX (url)
4
-
5
- == DESCRIPTION:
6
-
7
- A ruby wrapper for ImageMagick command line.
8
-
9
- - Why?
10
-
11
- I was using RMagick and loving it, but it was eating up huge amounts of memory. A simple script like this...
12
-
13
- Magick::read("image.jpg") do |f|
14
- f.write("manipulated.jpg")
15
- end
16
-
17
- ...would use over 100 Megs of Ram. On my local machine this wasn't a problem, but on my hosting server the ruby apps would crash because of their 100 Meg memory limit.
18
-
19
- - Solution!
20
-
21
- Using MiniMagick the ruby processes memory remains small (it spawns ImageMagick's command line program mogrify which takes up some memory as well, but is much smaller compared to RMagick)
22
-
23
-
24
- == FEATURES/PROBLEMS:
25
-
26
- MiniMagick gives you access to all the commandline options ImageMagick has (Found here http://www.imagemagick.org/script/mogrify.php)
27
-
28
- == SYNOPSIS:
29
-
30
- Want to make a thumbnail from a file...
31
-
32
- image = MiniMagick::Image.from_file("input.jpg")
33
- image.resize "100x100"
34
- image.write("output.jpg")
35
-
36
- Want to make a thumbnail from a blob...
37
-
38
- image = MiniMagick::Image.from_blob(blob)
39
- image.resize "100x100"
40
- image.write("output.jpg")
41
-
42
- Need to combine several options?
43
-
44
- image = MiniMagick::Image.from_file("input.jpg")
45
- image.combine_options do |c|
46
- c.sample "50%"
47
- c.rotate "-90>"
48
- end
49
- image.write("output.jpg")
50
-
51
- Want to manipulate an image at its source (You won't have to write it out because the transformations are done on that file)
52
-
53
- image = MiniMagick::Image.new("input.jpg")
54
- image.resize "100x100"
55
-
56
- Want to get some meta-information out?
57
-
58
- image = MiniMagick::Image.from_file("input.jpg")
59
- image[:width] # will get the width (you can also use :height and :format)
60
- image["EXIF:BitsPerSample"] # It also can get all the EXIF tags
61
- image["%m:%f %wx%h"] # Or you can use one of the many options of the format command found here http://www.imagemagick.org/script/command-line-options.php#format
62
-
63
-
64
- == REQUIREMENTS:
65
-
66
- You must have ImageMagick installed.
67
-
68
- == INSTALL:
69
-
70
- If you downloaded the plugin version, just drop the plugin into RAILS_ROOT/plugins/
71
-
72
- If you installed this as a gem, then to get it to work add <require "mini_magick"> to RAILS_ROOT/config/environment.rb
73
-
74
- If you have just downloaded this files then copy the mini_magick.rb file into your RAILS_ROOT/lib directory and add <require "mini-magick"> to RAILS_ROOT/config/environment.rb
75
-
76
- MiniMagick does NOT require rails though. All the code you need to use MiniMagick is located in the mini_magick/lib/mini_magick.rb file.
77
-
78
- == LICENSE:
79
-
80
- (The MIT License)
81
-
82
- Copyright (c) 2007 FIX
83
-
84
- Permission is hereby granted, free of charge, to any person obtaining
85
- a copy of this software and associated documentation files (the
86
- 'Software'), to deal in the Software without restriction, including
87
- without limitation the rights to use, copy, modify, merge, publish,
88
- distribute, sublicense, and/or sell copies of the Software, and to
89
- permit persons to whom the Software is furnished to do so, subject to
90
- the following conditions:
91
-
92
- The above copyright notice and this permission notice shall be
93
- included in all copies or substantial portions of the Software.
94
-
95
- THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
96
- EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
97
- MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
98
- IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
99
- CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
100
- TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
101
- SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/init.rb DELETED
@@ -1,2 +0,0 @@
1
- require 'mini_magick'
2
- require 'image_temp_file'
@@ -1,13 +0,0 @@
1
- require "tempfile"
2
-
3
- module MiniMagick
4
- class ImageTempFile < Tempfile
5
- def make_tmpname(basename, n)
6
- # force tempfile to use basename's extension if provided
7
- ext = File.extname(basename)
8
-
9
- # force hyphens instead of periods in name
10
- sprintf('%s%d-%d%s', File.basename(basename, ext), $$, n, ext)
11
- end
12
- end
13
- end
@@ -1,14 +0,0 @@
1
- require 'test/unit'
2
- require File.join(File.dirname(__FILE__), '../lib/image_temp_file')
3
-
4
- class ImageTest < Test::Unit::TestCase
5
- include MiniMagick
6
-
7
- def test_image_temp_file
8
- tmp = ImageTempFile.new('test')
9
- assert_match %r{^test}, File::basename(tmp.path)
10
- tmp = ImageTempFile.new('test.jpg')
11
- assert_match %r{^test}, File::basename(tmp.path)
12
- assert_match %r{\.jpg$}, File::basename(tmp.path)
13
- end
14
- end
@@ -1,127 +0,0 @@
1
- require 'test/unit'
2
- require File.join(File.dirname(__FILE__), '../lib/mini_magick')
3
-
4
- class ImageTest < Test::Unit::TestCase
5
- include MiniMagick
6
-
7
- CURRENT_DIR = File.dirname(File.expand_path(__FILE__)) + "/"
8
-
9
- SIMPLE_IMAGE_PATH = CURRENT_DIR + "simple.gif"
10
- TIFF_IMAGE_PATH = CURRENT_DIR + "burner.tiff"
11
- NOT_AN_IMAGE_PATH = CURRENT_DIR + "not_an_image.php"
12
- GIF_WITH_JPG_EXT = CURRENT_DIR + "actually_a_gif.jpg"
13
- EXIF_IMAGE_PATH = CURRENT_DIR + "trogdor.jpg"
14
-
15
- def test_image_from_blob
16
- File.open(SIMPLE_IMAGE_PATH, "rb") do |f|
17
- image = Image.from_blob(f.read)
18
- end
19
- end
20
-
21
- def test_image_from_file
22
- image = Image.from_file(SIMPLE_IMAGE_PATH)
23
- end
24
-
25
- def test_image_new
26
- image = Image.new(SIMPLE_IMAGE_PATH)
27
- end
28
-
29
- def test_image_write
30
- output_path = "output.gif"
31
- begin
32
- image = Image.new(SIMPLE_IMAGE_PATH)
33
- image.write output_path
34
-
35
- assert File.exists?(output_path)
36
- ensure
37
- File.delete output_path
38
- end
39
- end
40
-
41
- def test_not_an_image
42
- assert_raise(MiniMagickError) do
43
- image = Image.new(NOT_AN_IMAGE_PATH)
44
- end
45
- end
46
-
47
- def test_image_meta_info
48
- image = Image.new(SIMPLE_IMAGE_PATH)
49
- assert_equal 150, image[:width]
50
- assert_equal 55, image[:height]
51
- assert_match(/^gif$/i, image[:format])
52
- end
53
-
54
- def test_tiff
55
- image = Image.new(TIFF_IMAGE_PATH)
56
- assert_equal "tiff", image[:format].downcase
57
- assert_equal 317, image[:width]
58
- assert_equal 275, image[:height]
59
- end
60
-
61
- def test_gif_with_jpg_format
62
- image = Image.new(GIF_WITH_JPG_EXT)
63
- assert_equal "gif", image[:format].downcase
64
- end
65
-
66
- def test_image_resize
67
- image = Image.from_file(SIMPLE_IMAGE_PATH)
68
- image.resize "20x30!"
69
-
70
- assert_equal 20, image[:width]
71
- assert_equal 30, image[:height]
72
- assert_match(/^gif$/i, image[:format])
73
- end
74
-
75
- def test_image_resize_with_minimum
76
- image = Image.from_file(SIMPLE_IMAGE_PATH)
77
- original_width, original_height = image[:width], image[:height]
78
- image.resize "#{original_width + 10}x#{original_height + 10}>"
79
-
80
- assert_equal original_width, image[:width]
81
- assert_equal original_height, image[:height]
82
- end
83
-
84
- def test_image_combine_options_resize_blur
85
- image = Image.from_file(SIMPLE_IMAGE_PATH)
86
- image.combine_options do |c|
87
- c.resize "20x30!"
88
- c.blur 50
89
- end
90
-
91
- assert_equal 20, image[:width]
92
- assert_equal 30, image[:height]
93
- assert_match(/^gif$/i, image[:format])
94
- end
95
-
96
- def test_exif
97
- image = Image.from_file(EXIF_IMAGE_PATH)
98
- assert_equal('0220', image["exif:ExifVersion"])
99
- image = Image.from_file(SIMPLE_IMAGE_PATH)
100
- assert_equal('', image["EXIF:ExifVersion"])
101
- end
102
-
103
- def test_original_at
104
- image = Image.from_file(EXIF_IMAGE_PATH)
105
- assert_equal(Time.local('2005', '2', '23', '23', '17', '24'), image[:original_at])
106
- image = Image.from_file(SIMPLE_IMAGE_PATH)
107
- assert_nil(image[:original_at])
108
- end
109
- end
110
-
111
- class CommandBuilderTest < Test::Unit::TestCase
112
- include MiniMagick
113
-
114
- def test_basic
115
- c = CommandBuilder.new
116
- c.resize "30x40"
117
- assert_equal "-resize 30x40", c.args.join(" ")
118
- end
119
-
120
- def test_complicated
121
- c = CommandBuilder.new
122
- c.resize "30x40"
123
- c.input 1, 3, 4
124
- c.lingo "mome fingo"
125
- assert_equal "-resize 30x40 -input 1 3 4 -lingo mome fingo", c.args.join(" ")
126
- end
127
- end